This topic describes how to use the updated data filter in DataV widgets. You can write code in the data filter to convert data structures, filter data, and perform simple calculations.

Background information

Compared with the previous data filter, the updated data filter removes global filters that can be shared across DataV projects. Filters can only be used within one project. If you want to use them across projects, you must save the filters as code snippets.

Before you use the upgraded data filter, note the following information:
  • If you have used global filters in your project, the project editor saves them as code snippets on the Code Snippets page.
  • When you edit or create filters in an existing project, the system prompts you to update the data filter. The data filter is automatically updated for new projects.
  • After you update the data filter, the page refreshes, and the data filter is updated only for the current project. The update does not affect other existing projects.

Procedure

  1. Log on to the DataV console.
  2. On the Projects page, click the project you created.
    If no project is available, create a project first. For more information, see Create a project by using a template.
  3. On the editor, click a widget in the Layer panel or on the canvas.
    Notice Before you search for a widget, make sure that you have added the widget to your project. For more information, see Add a widget.
  4. Click the Data tab.
  5. On the Data tab, select Data Filter and click Add Filter.Add Filter
  6. In the Set Data Source pane, click + on the right of Add Filter.Set Data Source
  7. In the filter edit box, enter code to filter the widget data.
    For more information, see Example.
  8. Click Test to view the filter result.Test the filter code
    Notice To test the filter code, you must turn on the Filter Debugging switch. However, we recommend that you turn off this switch when the volume of widget data is large.
  9. After you test the code, click the Refresh icon on the right of Data Response Result to view the data filter result on the widget.
    For more information, see Detailed functions.