HowTo: Using the Data Source From property

Official Content
This documentation is valid for:

At present, we often find dynamic controls such as Combo Boxes or Wheels in both Web and Smart Device applications, which are used to dynamically restrict data entry by a user. This feature enables us to indicate the data source for these controls in an easy, clear and reusable way.

Purpose

Make it possible to choose, at design time, where to obtain the data for controls of Dynamic Combo Box, Dynamic List Box or SD Wheel type, with the ability to choose between options such as Attributes or Data Providers.

How it works

For example, let's consider an application called LightCRM, which enables users to schedule Meetings with a certain Contact of a Company. To schedule a new meeting, among other things, we have to indicate the Company name as well as that of the Contact with whom the meeting will be held. Suppose that we want, on the Web and Smart Devices, to display a Dynamic Combo Box with a Company’s Contacts which should be ordered by birth date.

To do so, we need to use Data Providers as data source for the controls to be used.
First, we create a Structured Data Type object and name it “ContactsSDT”.

DataSourceFrom_ContactsSDT

Next, we create an object of DataProvider type and name it "GetContactsByBirthday". We drag the ContactsSDT object to the Source panel of this DataProvider.

DataSourceFrom_DataProvider_SDT

We change the Source of the "GetContactsByBirthday" object as shown below:

ContactsSDT
{
    ContactsSDTItem
    order ContactBirthday
    {
        ContactId  = ContactId
        ContactName = ContactName
    }
}

We add the following rule to the Rules section:

Parm(CompanyID);

How it works in Web

We change the Web Form of the Meeting Transacción and set the properties of the ContactID attribute as shown in the image below:

DataSourceFrom_WebForm_Properties

To test it, select Run on the Web Panel object called "Home", go to Meetings and create a new record by clicking on the Insert button.

DataSourceFrom_WebDemo

How it works in Smart Devices

Just like on the web, to test it we open the "WorkWithDevicesMeeting" object and change the Edit layout on the "Section(General)" level and the properties of the ContactID attribute as shown in the image below:

DataSourceFrom_LayoutSD

Note: If "WorkWithDevicesMeeting" is configured with another Layout of Edit type, the same changes have to be made if we want to show the same features in all platforms.

Lastly, run the "LightCRM" Dashboard on a device and test it by adding a new Meeting record.

DataSourceFrom_SDDemo

Considerations

  • When using the DataProviders option, parameters can be used for DataProviders by setting the “Parameters” property that is displayed after selecting this option.
  • On selecting a DataProvider, the first numeric attribute and the first descriptor attribute of the SDT returned by the DataProvider are automatically selected.
  • For Smart Devices, the SD Wheel control can be used with the same settings as for the Dynamic Combo Box control.

See also