Options from DataSource
DataSources can be used to map available options in selectable fields, such as combo boxes or multi-select combos. This eliminates the need to manually define options in the form’s code, especially when these options may change over time or are too numerous to handle directly within the Pragmatic platform.
Required Output Fields
Regardless of whether the DataSource retrieves its data from an SQL query, MongoDB, or a JavaScript function, it must return at least two output fields:
value: This field represents the internal value that will be stored when the user selects an option. It is essentially the unique identifier of the selected option.
label: This field contains the name or label that will be displayed to the user as the selectable option. It is the text visible to the user.
Creating a DataSource that Solves Options
To create a new DataSource that solves options, follow these steps:
Step 1: Define the DataSource
Set up your SQL query, MongoDB query, or JavaScript function so that the returned results include the value
and label
fields.
Step 2: Verify the “Solve options” Label
Once the DataSource is correctly created, ensure that the “Solve options” label is included in the DataSource header. This indicates its specific purpose for mapping options. If it is not displayed, adjust the query you created.
Step 3: Use the DataSource in a Field
Use the Pragmatic interface to create a combo box or multi-select combo field. In the available options, you will find the newly created DataSource and be able to select it. To learn how to create a field, visit this link.
