Skip to main content
Query data step

Used to retrieve data from existing data lists and perform specific actions based on the query results.

Updated over a month ago

The Query Data step type is a functional module in process design, primarily used to retrieve data that meets specific conditions from designated data sources and apply it to subsequent steps. This type of step supports querying external data sources and allows for filtering, sorting, and saving of query results, helping users flexibly handle data within the process.


When to Use the Query Data Step

The Query Data step type can be used when the process requires extracting data from a database or other data sources based on specific conditions. Typical scenarios include:

  • Retrieving data submitted by users through forms

  • Filtering records that meet criteria from the database

  • Statistical analysis and reporting of data within the process

Note:

The Set Variable step type is suitable for various form types, including list forms, approval forms, and dashboards.


Configuring Query Data

  • Execution Conditions: Set the trigger conditions for querying data, which can be configured based on different business logic. For more details on execution conditions, please refer to the execution conditions of actions.

  • Application: Select the context of the current application, typically the application system from which the data is sourced.

  • Data Source: Choose the data source to query from the dropdown list. This can include the following types: data lists, document libraries, form reports, and data reports.

  • Data Filter: Set filtering criteria to select records that meet the specified conditions. Click the "Condition" button to open the conditions settings window.

    Click the "Add Condition" button to add a new condition for filtering data. The first dropdown lists all fields of the selected data source. The second dropdown includes condition options. For the third column, click the editor to open the expression editor and select values from list fields, contexts, etc. You can add multiple conditions to filter the data.

  • Primary Order and Secondary Order: Sort the query results by selecting fields to ensure the results are arranged in the desired order.

  • Query Result

    • Single Item: When selecting a single item, the system will extract specific fields from the data source and store the first record of the query result in a variable based on the same field type.

      1. Click the "Select Fields" button next to "Save Values to Variables" to open a popup window displaying the list fields.

      2. The first column contains the names of all fields in the data source list, the second column shows the field types, and the third column displays the associated variables.

      3. Check the fields you need to associate and select the correct variable type in the associated variable dropdown. This can be a list field, filter variable, or temporary variable. The dropdown will only display associated variables that match the selected field type.

      4. Click "OK" to save the settings.

    • Multiple Items: When selecting multiple items, the query results need to be saved to a variable of the sublist type.

      1. Click the "Select Fields" button next to "Save Values to Variables" to open the popup window.

      2. Under list fields, select an existing sublist or process variable. A temporary variable can be used to store the query results in a temporary variable for subsequent operations.

      3. After selecting the sub list or workflow variables, all list fields will appear. The first column shows all field names in the current list, the second column displays field types, and the third column contains the associated variables. Check the fields you want to use and select associated variables of the same field type in the "Associated Variable" column.

      4. You can also save the number of results to a variable. In the dropdown for saving the number of results to a variable, you can choose either a list field or a temporary variable.

      5. Page Number: Used to specify the page of items to be returned, with a default value of 1.

      6. Page Size: Specifies the maximum number of items returned in the response, defaulting to 100 and cannot exceed 1000.

Note:

If you use a data list, you can select List of Fields and Temp variables from the dropdown menu under "Associated List." If you use an approval form, the dropdown will display Workflow variables and Temp variables.

Through these steps, you can flexibly configure the Query Data step type to meet the data retrieval needs within the process.

Did this answer your question?