I. Description
In our usual use of widgets, we cannot avoid the need to reference the value of the widget. When referring to the value of the widget, the actual value and display value of the widget will be involved. Now we specifically divide which widgets have actual values and display values, and use of widget values!
II. Widget(Value) Comparison
Widget | Actual Value | Display Value | Whether the actual value display value is consistent |
---|---|---|---|
Text Widget | -- | -- | Yes |
Area Widget | -- | -- | Yes |
Number Widget | -- | -- | Yes |
Password Widget | -- | -- | Yes |
Button Widget | -- | -- | Yes |
Checkbox Widget | -- | -- | Yes |
Radio Button Group Widget | Yes | Yes | No |
Checkbox Group Widget | Yes | Yes | No |
Drop-down Box Widget | Yes | Yes | No |
Drop-down Checkbox Widget | Yes | Yes | No |
Date Widget | -- | -- | Yes |
File Widget | -- | -- | Yes |
List Widget | Yes | Yes | No |
Web Frame | -- | -- | Yes |
Drop-down Tree | Yes | Yes | No |
View Tree | Yes | Yes | No |
Note: For widgets such as Text, there is no difference between the actual value and the display value, but for the Drop-down Box, which can set a data dictionary to define the actual value and the display value, it is different.
III. Example-One
Let's first demonstrate the method of obtaining the display value and the actual value of the widget and the difference in use!
Process: New in the parameter pane: Drop-down Box Widget(t1), Radio Button Group Widget(t2), Checkbox Widget(t3), Drop-down Checkbox Widget(t4), Text Widget(t5) and Query button (submit)
Note: The above widgets are all independent and there is no linkage!
3.1 Drop-down Box Widget(t1)
1)Select the t1 button to set the dictionary:
2)Set the click event in the Query button, as follows:
JavaScript code:
var Widget1 = this.options.form.getWidgetByName("t1"); //To obtain the widget in the parameter interface, first obtain the decision report, and then obtain the widget by the widget name
var value_1 = Widget1.getValue(); //Get the actual value of the widget
alert('My actual value is:' + value_1); //Actual value of pop-up widget
var text_1 = Widget1.getText(); //Get the display value of the widget
alert('My diaplay value is:' + text_1); //Display value of pop-up widget
3)Effect preview: (the actual value is different from the display value)
The same setting: Radio Button Group Widget(t2), Checkbox Widget(t3), Drop-down Checkbox Widget(t4).
Get the same result: The actual value is different from the display value.
3.2 Text Widget(t5)
The Text Widget is different, its result shows: the actual value and the display value are the same.
Summary: At present, in addition to the Drop-down Box Widget, Radio Button Group Widget, Checkbox Widget, Drop-down Checkbox Widget, List Widget, Drop-down Tree, View Tree, these kinds of widgets can set the data dictionary to define the actual value and display value [ Except that the actual value and the display value are different], the actual and display values of other widgets are the same!
For details, please refer to the Widget(Value) Comparison above.
IV. Example-Two
If you get the value of a widget in a cell, what you get is the display value or the actual value of the widget!
Process: We get the values of parameter widgets t1, t2, t3, t4, t5 in cells B3, C3, D3, E3, and F3 of the report, respectively!
1) Setting method:
2)Effect preview:
Summary: The widget of the parameter interface is passed to the background or directly obtained in the cell, which is the [actual value] of the widget.
V. Example-Three:Actual Value Display Value is Many to One
As shown above, there is usually a one-to-one correspondence between the actual value and the display value. However, there are cases where different actual values correspond to the same display value. For example, the company name can be the same but the ID is unique, and the ID and the name form a many-to-one relationship.
10.0 The processing logic of the unified widget when multiple actual values correspond to the same display value:
1) When selecting a value directly in the widget, whether it is a parameter query or a new report, the actual value and the display are many-to-one, that is, the corresponding actual value is obtained from the selected display value.
2) When assigning a widget value by passing parameters, if the passed parameter is the actual value, it is consistent with the logic of selecting the value directly in the widget; if the passed value is a display value, the widget selects the first display value by default.
An example is given below.
5.1 Parameter Query
As shown in the figure, add an embedded dataset:
Add Drop-down Box, Drop-down Checkbox, Radio Button Group, Check Button Group, View Tree and Query button in the parameter setting interface, as shown in the following figure:
Note that when adding controls, modify the names of the wigets in order, here in order: a, b, c, d, e.
Take the Drop-down Box widget for example:
The rest of the widgets will not be explained much. The widget whose name has been modified is as shown in the figure below:
Note: formSubmit0 is the query button widget.
Then add data dictionary settings to each widget.
Let's take an example of the Drop-down Box widget, as shown in the figure below: the type of the data dictionary is set to Data Query; the actual value is: ID; the display value is: Name.
The Drop-down Checkbox, Radio Button Group, and Check Button Group are all set as the Drop-down Box in the figure above.
The View Tree is slightly different:
1) Please check [Multiselect] first;
2) Set up the data dictionary: select the construction method [Fast Layered Build]; select the newly built emedded dataset for the data set; select [ID] for the actual value; select [Name] for the display value. As shown below:
The parameter interface setting is completed, and then set the report body as shown in the figure:
Insert formulas into cells A2-E2 respectively, and enter the corresponding [$widget name].
The preview effect is as follows:
When the actual value display value is many to one, the different actual value can still be accurately obtained by selecting the same display value(Here you can think of Maria as Tom).
In addition, for widgets that can manually enter values (such as Drop-down Checkbox), if multiple identical display values are manually entered, only the first display value will be selected in the same widget as passing parameters, as shown in the following figure:
5.2 New Data Entry Preview
The Drop-down Box, Drop-down Checkbox, Radio Button, Checkbox Group and View Tree widget all display the display value before and after editing, as shown in the following figure:
Note: The display value will be displayed during editing in the preview of the data entry, and the actual value will be displayed after the end. The shape setting of the cell must be used to achieve the same effect as the new data entry. For details, please refer to Drop-down Box to Display Actual Value after Data Entry.
5.3 Transfer Parameters to Assign Widget Values
As explained above: When assigning a widget value by passing parameters, if the passed parameter is the actual value, it is consistent with the logic of selecting the value directly in the widget; if the displayed value is passed, the widget selects the first display by default value.
We still need to use the parameter query report created in 5.1 just now.
Then create a new report, and design the main body of the report as shown in the figure below:
Then add a hyperlink to the A1-F1 cell to the parameter query report used in 5.1, as shown in the figure below:
The settings of A1-E1 to add hyperlinks are as shown in the figure above, there is no difference.
Note: After setting the A1 cell hyperlink, you can directly copy A1 cell to B1-F1, and then modify the cell content to "2-5, Maria".
Save the template and preview it. The preview effect is as follows:
VI. Templates Download
1) Example-One
Click to download template:
Actual_Value_and_Diaplay_Value-Example1.cpt
2) Example-Two
Click to download template:
Actual_Value_and_Display_Value-Example2.cpt
3) Example-Three
Click to download template:
Actual_and_Diaplay-Example3-Parameter_Query.cpt
Actual_and_Diaplay-Example3-Transfer_Parameters.cpt
Actual_and_Display-Example3-Data_Entry.cpt