Hello, how can we help you?

Recent Searches: How to configure a grid in a form - How to use a REST Web Service data source - How to use a Web Service data source - How to use a ComboBox data source

Search for external data via dataset

This topic will teach you how to create a list of values with users searched for in the database via dataset, with SQL commands.

As an example, we will use a travel request form.

To this end, simply follow the steps below:

 

1st step: Create a dataset type

Datasets are searches in the database.

To create a dataset, it is necessary to enter a type to keep it all organized.

To do so, go to the Dataset type (FO011) menu and click on the button.

On the screen that will open, fill in the ID # field with "datasetadm", and the Name field with "Administration".

Done. We have successfully created a dataset type!

 

2nd step: Create a dataset

To create a dataset, go to the Dataset (FO009) menu and click on the button.

On the screen that will open, enter data, as shown in the image below, and click on the Next button.

Select the "SESUITE" data source, which, by default, is already saved in the database.
Write the SQL, as shown in the table below, and click on the Run button.

SELECT
	U.CDUSER  AS UserCode
	,U.IDUSER AS UserID
	,U.NMUSER AS UserName
FROM
	ADALLUSERS U
WHERE
	U.FGUSERENABLED = 1

Click on the Next button until the Security step. 

Set the view security as public and click on the Finish button.

Done. We have successfully finished the creation of the dataset!

 

3rd step: Create the dataset list of values

For this step, access the editor screen of the "Employee" form through the FO005 menu.

On the screen that will open, select and drag the Data source list field to the modeling area.

Keep the field selected and click on the Element configuration button.

Change the title to "Employee leader" and click on the Data source button.

On the screen that will open, enter "SESUITE" for the data source and "All Users" for the dataset.

Then, access the Persist info panel and click on the Select fields button.

Enable all fields to be persisted and click on the Apply button.

Now we have 3 fields to be persisted. The dataset makes it possible to configure variables as value destination.

Each variable has a corresponding field in the form table.

Thus, we can persist several values without the need to use hidden fields in the form, making maintenance simpler.

Then, click on the button of the usercode field.

On the screen that will open, fill in the Variable field with "varUserCode".

Now, we will create the variable by clicking on the Create varUserCode button.

On the variable screen, we will associate a table field.

Because we have not yet created the field, we will do it by filling in the field with the "CDUSER" value and clicking on the Create button.

On the field screen, enter the "cduser" value for the ID #, "CDUSER" for the name, and select the "Integer" type.

After doing that, click on the Save & close button.

After creating the variable, disable the "Visible" option so that the code is no longer shown on the screen to the user, but is only persisted instead.

Repeat this process and create two new variables: for the Userid field, create the "varUserId" variable, and for the Username field, create the "varUserName" variable. However, in these cases, configure the field type as "Text".

Now, we will preview the result by accessing the form editor through the FO005 menu.

Done. Now you already know how to create a dataset, to create a list using this dataset, and to manage variables!


Was this article helpful?