All Products
Search
Document Center

DataV:Detailed functions

Last Updated:Apr 17, 2024

This topic describes how to use a data filter, such as creating a filter, adding a filter, sorting a filter, and creating a code snippet.

  1. Log on to the DataV console .

  2. On the My Visualizations page, click Edit above the project that you created.
  3. You can perform the following operations in the editor:

Create a filter

You can create a filter by using one of the following methods:

  • Click the Data Filter icon.
    1. In the toolbar of the Visual Editor, click the Data Filter icon. 进入项目过滤器
    2. In the Data Filter pane, click New Filter.
    3. In the Filter Settings section, enter a filter name and a custom filter code, and then click Save. 方法一新建过滤器步骤
      The created filter appears in the list.
      Important The filter created by using Data Filter can be called by any asset in the current visual application. For more information about how to call the filter, see How to use the filter. The dependencies of the asset and filter are displayed when called.
  • Create an asset by using the data configuration of the asset.
    1. Add a random asset to the current visualization application and click the Data icon in the right-side configuration pane.
    2. In the Data panel, select Data Filter and click Add Filter. 添加数据过滤器入口
    3. On the Set Data Source page, click 添加on the right of Filter. 新增一个过滤器
    4. In the filter edit box, specify a name for the filter and enter the filter code. Then, click Save.

      The created filters are listed in the data filter list, and the dependencies between the filters and assets are displayed.

      When you configure the internal data of an asset, the created filters are also displayed in the Data Filters list. You can also view the dependencies between the filters and the asset in the list. 过滤器显示被组件调用

Rename a filter

Move the pointer over a filter in the filter list, click the Rename icon, and then enter a filter name. 重命名过滤器

Delete a filter

Important If you delete a filter, the related assets may become unavailable. Please confirm the operation before you delete the filter.
Move the pointer over a filter in the filter list and click the Delete icon. 删除过滤器

Add a filter

  1. In the Data configuration panel, select Data Filter.
  2. Click Add Filter.
    添加数据过滤器入口
  3. In the Set Data Source step, select an existing filter from the Add Filter drop-down list.

Sort the filters

After you add multiple filters to an asset, you can sort by dragging the filters.

After multiple filters are added to the asset data, the data is filtered from top to bottom, followed by the sorted filters. The input of the first filter is the data returned by the data source, the input of the second filter is the output of the first filter, and so on.

Important
  • If multiple filters are added to an asset and one of the filters is empty, the filter is ignored but the filtering is not terminated. In addition, the system displays a message on the configuration page of multiple filters.
  • If multiple filters are added to an asset and an error occurs when a filter is executed, the filter is terminated and the correct result of the last execution is used.

Debug a filter

  1. In the Set Data Source section, click Enable Filter Debugging below Data Filter.
  2. Edit the filter code and click Test.
    After the debugging is complete, a box appears on the left to show the filter result. As shown in the following figure, the upper and lower parts of the pop-up window on the left show the returned results before and after the data passes through the filter. 测试数据结果
    Important Filter debugging ensures that the filter code is correct, but it is not applicable to widgets that contain a large volume of data.

Data source and filter errors

  • Data Source Error: After you add a data filter to the Data Assets panel, if you switch the current data source to another data source type, the following two errors are displayed in the Data panel, indicating that the data source configuration is incorrect. 数据源异常
    Important When the data source is abnormal, the data it returns is incorrect. Therefore, the data filter does not filter data and is dimmed on the Data tab.
  • Filter error: If the filter encounters an exception when it filters data, an error is reported in both the filter and the filter output.
    Figure 1. Error 1 过滤器执行报错1
    Figure 2. Error 2 过滤器执行报错2

Manage the Data Filter pane

In the Data Filter panel on the left side of the application, you can manage the filters for all assets in the application and view the dependencies between the filters and the assets. The filters in the panel can be added to any asset in the visualization application. 管理过滤器面板
Important When you modify the content of a filter in the Filters panel, all assets that depend on this filter are affected. Exercise caution when you modify the content.

Create and import a code snippet

You can create a code snippet from a filter and import the code snippet to the filter. This allows you to call the filter across projects.

  1. Move the pointer over a filter in the filter list and click the Create Code Snippet icon.
    创建代码片段入口
  2. In the Create Code Snippet dialog box, view and modify the Name and Code, and click OK.
    创建代码片段
  3. After the code snippet is saved, click Code Snippet Management on the My Data page to view and manage the code snippet.
    代码片段管理页面
    Note On the Snippet Management page, you can click Create above the snippet list to create a new snippet and save it to the list.

    After the code snippet is successfully created, you can proceed with the following steps to import the code snippet to the asset for application.

  4. Right-click the code editor and select an existing code snippet in the Import dialog box to import the code snippet.
    右键导入代码片段
    Note You can create and import code snippets to share and use filters across projects.