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 also as a data definition that is then used by a JavaScript routine that you script.
Data sources are typed as Info, Lookup, Related, Dropdown or Variable Set data sources. Each of these is discussed in a section below:
•Info data sources are the standard connection to data that are searched, selected or manipulated. •Lookup data sources are for searching and selecting foreign key values from a lookup window (eg., selecting a Product for an Orderline). •Dropdown data sources are for selecting foreign key values from a dropdown list (eg., selecting the Country of Origin of a Product). •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 with values that do not come from the database. Option controls are also used for this purpose.
Data source objects and related objects appear as classes in the DataSource Objects folder of the Controls catalog of Web Designer. This allows you to create your own subclasses of these controls and use them in customised pages:
In addition, data source objects are applied by default in the default pages that USoft creates on the basis of the data model that you defined in USoft Definer. They are the page classes in the DataPage folder of the Pages catalog of Web Designer. For example, here is a lookup page that contains a PERSON default lookup data source based on a relationship between the PERSON and RESERVATION tables:
|
An info data source based on a table T provides a standard connection to data stored in T so that these data may be searched, selected and manipulated in a web page.
Info data sources are the default type of data source. Use an info data source unless you specifically need a lookup data source, a related data source, or a dropdown data source.
Info data source objects and the classes that type them are simply named after the database table they are based on ("PERSON"). In the Controls catalog, you also find classes starting with "Info..." ("Info PERSON") to signpost the difference with other types of data source.
|
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:
|
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 and just expands a dropdown list, instead of stepping out to a lookup page.
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:
|
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:
|
Variable Set data sources are used for page-level scripting: they do 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 option controls at GUI level, for example if you want to:
•Restrict the number of allowed values in the domain. 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
|