Overview
Application Scenario
For data entry templates that contain multiple widgets, after you select the value of a widget, you want the value of another widget to change accordingly. This effect can be achieved by the Data Dictionary function, as shown in the following figure.
Implementation Method
You can achieve the linkage effect in data entry templates via three methods.
Use a SQL dataset to filter data. (The data of expanded widgets can also have the linkage.)
Use the SQL function (The data of expanded widgets can also have the linkage, but performance risks may appear in terms of large amounts of data.)
Use the VALUE function. (The data of expanded widgets can also have the linkage.)
Notes
1. The linkages can only be unidirectional and cannot be bidirectional. For example, you can set the data dictionary of Widget B to change with the value of Widget A, but in this case you cannot set the value of Widget A to change with the value of Widget B.
2. The three-level linkage is not supported. That is, if the value of Widget B is subject to that of Widget A, you cannot further set the value of Widget C to be subject to that of Widget B.
3. When you set the data dictionary linkage for the widget in a cell, the linkage parameter should be the cell rather than the widget name.
4. The set value of a widget (whose value is subject to that of another widget) will be cleared if a data dictionary linkage is triggered. For example, if the value of the City widget is subject to that of the Region widget, the city you have selected before will be cleared once you select the region.
Example
Template Preparation
Create a template in the designer and design a table according to the following style.
Method One: SQL Dataset
1. Add a dataset ds2 with the SQL statement: SELECT City FROM Employee_copy where Region='${C9}', which is to limit the data of the City widget by the value in the C9 cell (Region) by using the WHERE statement.
2. Select the C9 cell (Region). Modify the name of the drop-down box widget to Region. Select ds1 from the drop-down list of Dataset on the Data Dictionary setting page, as shown in the following figure.
3. Select the F9 cell (City). Select ds2 from the drop-down list of Dataset on the Data Dictionary setting page, as shown in the following figure.
Method Two: SQL Function
Select the F9 cell. Select Formula from the drop-down list of Type on the Data Dictionary setting page. Enter the formula SQL("FRDemo","select City from Employe_copy where Region='"+C9+"'",1) in the input box of Actual Value. Enter the formula $$$ in the input box of Display Value, as shown in the following figure.
Method Three: VALUE Function
Select the F9 cell. Select Formula from the drop-down list of Type on the Data Dictionary setting page. Enter the formula value("ds1",8,9,C9) in the input box of Actual Value. Enter the formula $$$ in the input box of Display Value, as shown in the following figure.
The formula is described below.
Return the value of City (the eighth column in ds1) corresponding to that of Region (the ninth column in ds1) in the dataset ds1.
Effect Display
1. On PC
Save the template and click Data Entry Preview. The following figure shows the preview effect.
2. On Mobile Terminals
The function is also supported on the DataAnalyst App and H5 terminals, as shown in the following figure.
Template Download
You can download the template: Data Entry Dropdown-Box Linkage.cpt