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.
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.
- 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.
- Log on to the DataV console.
- 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.
- On the editor, click a widget in the Layer panel or on the canvas.
- Click the Data tab.
- On the Data tab, select Data Filter and click Add Filter.
- In the Set Data Source pane, click + on the right of Add Filter.
- In the filter edit box, enter code to filter the widget data.
For more information, see Example.
- Click Test to view the filter result.
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.
- 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.