Data Sources

Previous Next

Data sources allow USoft web pages to access stored data. For you as a developer, they provide access to data without the need to code SQL statements manually.

You can use a data source to get data displayed in fields, but as a data definition used by JavaScript routines.

Data sources are typed as Info, Lookup, Related, Dropdown or Variable Set data sources:

Info data sources are the standard connection to data that are searched, selected or manipulated.

Lookup data sources are for searching and selecting parent data for use in a foreign key in the child (eg., selecting a Product for an Orderline).

Related data sources are for accessing child data related to a currently selected parent (eg., all the Orders of a given Customer).

Variable Set data sources are for populating dropdown lists that users must be able to select data from. Option controls are also used for this purpose.

Info data sources are simple. Their working depends mainly on the table they are connected with.

But in an application, data and data sources from connected pages from different blocks in the same page must be made to work in combination and to pass data to each other and to the user in a variety of ways. A number of object types is used to achieve this: Lookup, Relate, LookupColumn, RelateColumn, Option, TableColumn, Variable, and VariableSetDataSource. These object classes are found in the DataSource Objects folder on the Controls tab of the catalog:

You can build structures with these object types from scratch. But the USoft default application offers many of these structure ready-made. It is usually easier to take these as a starting point and modify them as appropriate.

 

Info data sources

An info data source provides a standard connection to data that are searched, selected or manipulated in a web page. Use an info data source unless you specifically need a lookup data source, a related data source, or a dropdown data source.

Lookup data sources

A Lookup Data Source is typically used to look up parent data for use in the context of a child table. For example, when you add a new Reservation for an existing booker, maybe you look up the booker in a Person table for use in the Reservation.

In the controls catalog there is a Lookup data source available for each parent in each relationship of your data model. Default lookup pages contain a lookup data source by default. A lookup data source has a Lookup object with one or more LookupColumn child objects to determine the way in which the lookup data are connected to the foreign keys at child level:

WD_clip0029

 

Related data sources

A related data source is typically used to provide access to child data for use in the context of corresponding parent data. For example, when a user has searched, selected or entered Person data, a next step might be to search, select or enter Reservation data in which that Person is the booker.

In the controls catalog there is a Related data source available for each child in each relationship of your data model. Default related pages contain a related data source by default. A related data source has a Relate object with one or more RelateColumn child objects to determine the way in which the related data are connected to the parent data they belong to:

WD_clip0033

 

Dropdown data sources

A dropdown data source is typically used to select a parent value for use in a foreign key field (that is, at child level). For example, when you add a new Scheduled Tour, maybe you look up the tour guide of that Scheduled Tour in a Guide parent table. This is similar to how a lookup data source works, but the user remains on the same page instead of stepping out to a lookup page to select the parent value.

For each relationship in your data model that has Lookup Method = Dropdown List, default pages that have a foreign key field for that relationship contain a dropdown data source by default. A default data source has a Lookup object with one or more LookupColumn child objects to determine the way in which the lookup data are connected to the foreign keys at child level:

WD_clip0031

Variable Set data sources

This type of data source is used for page-level scripting: it does not connect to database data. Variable Set data sources can store any kind of variable.

A Variable Set data source holds only one record if it is used for variables procedural scripting (JavaScript). It may also serve as output data source for a SQL Statement, in which case it might hold more then one record. You cannot search a Variable Set data source.

In USoft 8, Variable Set data sources were important for holding global host variables during page navigation. In USoft 9, the top-level document is no longer replaced by a different document; only page components are replaced. For this reason, there is no longer any need for data sources to hold global host variables. In USoft 9, the only reason to use new Variable Set data sources is to present screen-level data to the user, for example, in TextColumnControls. Screen-level data are data that are not stored in the database.

Option controls

In a USoft application, options (= possible values) for radio buttons and dropdown lists are often not painted at GUI level, but generated on the basis of allowed values in domains with Display Type = Check Box, Option Buttons, or Dropdown List Box.

But you may also:

Use GUI controls for option values to restrict the number of allowed values in the domain. For example, you could have a domain with 4 allowed values, but in a specific web page, you only want the user to be able to choose from 3 of these values. In this case, you can manually add options to a Variable or Table Column object, and then link the desired control with the associated data source items.

Build your own option controls that are not linked to values in database columns.

 

 

See Also

Embedded Data Sources

Data Source Path Syntax

Life Time Data Source Property

Page and Data Source Constructs

Page and Data Source Constructs

 

How to Define a Related Data Source

How to Define a Lookup Data Source

How to Insert a User-Defined Data Source

How to Define a Variable Set Data Source