Script Data Source¶
This data source executes a script and returns the result as a list of values.
The script data source enables the execution of custom scripts to dynamically generate data for form controls.
The script's result must be an array of objects, each defining the properties of an option within the list of values.
The script also supports asynchronous operations using async/await patterns. The script is expected to complete within a 500ms duration; otherwise, a progress dialog will be displayed to the user.
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
In this example:
TextFormatis set to{{name}}, indicating that thenameproperty within each object returned by the script will be used for display text.ValueFormatis set to{{value}}, specifying that thevalueproperty within each object will be used as the underlying value.- The
Sourceelement contains theContentelement, which encapsulates the script to be executed. - The script is a simple JavaScript code block that returns a static array of two objects. Each object has
nameandvalueproperties, which will be used to populate the data source.
In summary, this data source will execute the provided JavaScript code, which will generate a list of two items. The first item will have a display text of "A" and a value of 1, and the second item will have a display text of "B" and a value of 2.