Tutorials for common Blueprint Editor use cases
This topic explains and demonstrates solutions to common issues in the Blueprint Editor.
Video link
DataV classroom video: Blueprint Editor common use case tutorial video.
Case overview
Dynamically pass parameters when requesting a data API
This case demonstrates how to pass dynamic parameters when you request a data API to achieve data linkage between a Tab widget and a Ticker Board widget.
The configuration steps are as follows. For a detailed demonstration, see Dynamically pass parameters when you request a data API.
Before you start, add the widgets to the canvas editor and configure their data sources.
Add the Tab and Ticker Board widgets to the canvas editor and configure their data sources. Configure dynamic parameters in the format of :parameter_name.
Import the widgets that require interaction into the Blueprint Editor. Connect the When Tab Clicked event to the Request Data API action of the Ticker Board widget. Then, write a processing method in the sequence node.
NoteWhen a tab is clicked, a data request is triggered for the Ticker Board. The Ticker Board then adds the parameter
year:data.contentand requests the data again. For example, ifdata.contentis2020, thepostparameter for the API request becomesyear:2020, and thesqlcondition becomeswhere year=2020.
Dynamically control widget styles
This case demonstrates how to use the Blueprint Editor to dynamically control the style of a Ticker Board widget. The widget's value is displayed in red if it is greater than 60. Otherwise, the value is displayed in green.
The configuration steps are as follows. For a detailed demonstration, see Dynamically control widget styles.
Before you start, add the widgets to the canvas editor and configure their data sources.
In the configuration pane of Ticker Board A, copy the widget configuration. Examine the configuration hierarchy to find the field to modify. In this case, the field to modify is the
valuefield.Import the widget into the Blueprint Editor. Connect the When Data API Request is Complete event of the Ticker Board to the Update Ticker Board Configuration action in the sequence data processing node. Then, write a processing method in the sequence node.
NoteAfter the request is complete, the Ticker Board checks the
valuein the data. If the value is greater than 60, the number color is updated to red. Otherwise, the color is updated to green.
Display the sum of data from multiple widgets
This case uses the Blueprint Editor to display the sum of real-time data from two Ticker Board widgets, A and B, in a third Ticker Board widget named total.
The configuration steps are as follows. For a detailed demonstration, see Display the sum of data from multiple widgets.
First, add the widgets to the canvas editor and configure their data sources. Then, import the widgets into the Blueprint Editor. Connect the widget interactions as shown in the following figure, and write the processing methods in the sequence nodes.
Processing method for the sequence node of Ticker Board A:
Processing method for the sequence node of Ticker Board B:
When the data API request for Ticker Board A or B is complete, the first node in the sequence saves the value to a temporary page variable,
data_aordata_b.The processing method of the second node adds the newly requested data from the current ticker board to the saved data from the other ticker board. It then imports the result to the API of the Ticker Board widget named total.
Demos
Dynamically pass parameters when you request a data API
Add the Tab and Ticker Board widgets to the canvas editor and configure their data sources.
NoteYou can test the dynamic parameters. To preview the result, you can directly change the suffix in the URL.
Ignore any errors that occur because parameters are not included on the edit page.
After the widgets are configured, select the Tab and Ticker Board widgets in the Layers pane on the left. Right-click and select Export to Blueprint Editor.

On the Blueprint Editor page, add a component node and a Serial Data Management node from the Import Node bar on the left to the canvas. Connect the nodes as shown in the following figure. You also need to configure dynamic parameter passing and a method to call the data API for the Serial Data Processing node.
For more information about dynamic parameter passing, see the relevant documentation.return { year: data.content };For more information about how to request data, see:
return { year: data.content };After the configuration is complete, right-click a connection line and select Record Log to set up blueprint logs. Click the Test Preview
icon in the upper-right corner to view the preview.For more information about how to dynamically pass parameters when you request a data API, see How to dynamically pass parameters when requesting a data API.
Dynamically control widget styles
In the Blueprint Editor canvas, add a Sequence Data Processing node and connect the nodes as shown in the following figure. Then, add a method for the sequence data processing node.

The following code example shows how to configure the number color style based on the
valueafter the data API request is complete.return data[0].value - 40 >= 0 ? { "counter": { "numbers": { "textStyle": { "color": "#18F8B8"// The color to be modified } } } } : { "counter": { "numbers": { "textStyle": { "color": "#00C0FF" } } } }For more information about how to dynamically control widget styles, see How to dynamically control component styles.
Display the sum of data from multiple widgets
On the canvas editor page, add a Ticker Board widget and name it total Ticker Board. Then, right-click the widget and select Export to Blueprint Editor.
In the Import Node pane on the left of the Blueprint Editor page, click the total Ticker Board node to add it to the Blueprint Editor canvas.
In the Blueprint Editor canvas, add a Global node and a Sequence node. Connect the nodes as shown in the following figure. For more information about how to set temporary page variables, see Global node.

After connecting the nodes, set the methods for the sequence nodes.
Set the sequence node connected to Ticker Board B. The following is the sample code:
return { data:[ { name:"data_b", // You can customize the variable name. Make sure it is unique. value:data[0].value || 0 } ] };The following is the sample code for the second processing method:
let data_a = getLocalValue('data_a') || 0; let res = data && data.length !== 0 ? data[0].value + data_a : data_a return [{ value: res }];Set the sequence node connected to Ticker Board A in the same way. The following is the sample code:
return { data:[ { name:"data_a", // You can customize the variable name. Make sure it is unique. value:data[0].value || 0 } ] };Sample code for the second processing method:
let data_b = getLocalValue('data_b') || 0; let res = data && data.length !== 0 ? data[0].value + data_b : data_b return [{ value: res }];
After you configure the blueprint interaction, you can view the preview.
NoteIf you have many data sources, the implementation in DataV can be complex. We recommend that you set up the data sources in advance.
For more information about how to display the sum of data from multiple widgets, see How to display the sum of real-time data.

For more information about dynamic parameter passing, see the relevant documentation.
icon in the upper-right corner to view the preview.

