Distribute data

Updated at:

Use merge requests to fetch data once and distribute it to multiple widgets. In this example, the General Title widget requests data and distributes it to the Ticker Board and Multiline Text widgets.

Resultimage.png

Scenarios

Fetch data for multiple widgets at once from a data source such as an API or SQL query, then distribute the data to each widget. This reduces the number of data requests.

Procedure

  1. Access the DataV console.

  2. Select a data dashboard and click Edit to open the canvas editor.

  3. Add the General Title, Multiline Text, and Ticker Board widgets to the canvas.

  4. Select the Ticker Board widget. In the style configuration pane, clear the Title Content field.

  5. Select the Multiline Text widget, go to the Data Source tab, and enable Controlled Mode.

  6. Move the General Title widget off the canvas and modify its static data.

    Note

    The General Title widget is used only to request data. If you move it off the canvas, it will not be visible when you preview or publish the project.

    [{
      "num": "123",
      "text": "This is the multiline text widget",
      "value": "Data receiving widget"
    }]
  7. Switch to the Blueprint Editor.

  8. Add all layer nodes to the main blueprint canvas.

  9. Click Logic Node and add a Sequence node to the main blueprint canvas. Then, add a new event port to the node and rename it.image.png

  10. Connect the widgets.image.png

  11. Configure the processing method for the Sequence node.

    • Retrieve text

      return [{value: data[0].text}];
    • Retrieve number

      return [{value: data[0].num}];
  12. In the upper-right corner of the page, click the Preview icon to view the result.image.png