Populating Data Sources
DataSources are the data areas held within the UI, structured by the Entities, that are used by the App Pages and Functionality Actions in the App.
DataSources are usually populated with information, from the database, for display and manipulation within the app or as entry forms for new information that is to be written back to the database by the app e.g. a sales order. There are several ways to populate a Data Source.
The main way to get data into your DataSource is through a Selection. This selects data from your database and copies it into your DataSource. For example, if you want to populate an Organizations DataSource with all the records in your organization file you might perform a "SelectAll" selection or alternatively you might just select the records that have a type of Customer or similar. If the records you are reading/populating have associated Related Data then this must be read/populated seperately.
On entry into a Page Series
When defining a Page Series there is and option called "actions on load". This allows you to call upon Evoke Click Actions the first time a Page Series is accessed. There are several Click Actions that can be used to populate Data Sources.
The most common Click Action to populate Data Sources is a selection.
Here you can see the Click Action "Run Selection" being used. We have identified the Data Source that we want populated with data and identified the selection ID that we previously set up in Entities.
The selection will populate the Data Source and if the Data Source itself contains Entities then you can retrieve these into the Data Source using the Click Action "Retrieve Related Data".
Selections are defined against Entities and the Selection Statement in Data Mappings.
Via a button on a Page
The Button Widget that is set up as part of a Template has an "Actions on Click/Tap" option. This allows you to call upon Evoke Click Actions in response to the button being clicked. There are several Click Actions that can be used to populate Data Sources. The options are as shown above, where you can see the Click Action "Run Selection" being used. We have identified the Data Source that we want populated with data and identified the selection ID that we previously set up in Entities.
The selection will populate the Data Source and if the Data Source itself contains Entities then you can retrieve these into the Data Source using the Click Action "Retrieve Related Data".
When navigating to another Page
Navigation, such as Header navigation or Grid Row Navigation have Evoke Click Actions that are actioned in response to the header menu being used or grid row navigation being used. As above, there are several Click Actions that can be used to populate Data Sources such as "Run Selection" (see above).
As part of Widget e.g. a selection
just like the Button Widget there are several other Widgets that populate Data Sources. Widgets such as SelectAuto, SelectAutodrop, Lookup, etc. Each that is set up as part of a Template have the ability to run selections as part of the Widget.
Populating Related Data
Many data structures have "Related Data". Related Data can be other associated records linked via (in MultiValue databases) Local keys, remote keys, Embedded MultiValues, Embedded Subvalues, etc) or (in SQL databases) Joins or Link tables. When you populate a DataSource with a Selection (button, click action, page action, etc) then the Related Data is NOT populated (read from the database). The reason that the Related Data is not populated is for Optimisation, usually you only need to read the Related Data of a record when you use that record and so the Related Data can be read, incurring any database read/access overhead, at that time.
When you perform a Selection via an Click Action (see image right) then you will need to use the additional Evoke Click Action "RetrieveRelatedData" to identify and populated the associated data/records to also populated. The "Add" button will launch a builder to help you identify the available Related Data to load. Populated Related Data does NOT need its own DataSource, the Related Data is read and associated with the DataSource that you used with your Selection.
When you perform a Selection via an Widget or Button (see image left) then you should identify and populate the associated data/records (Related Data) using the "Entity Properties to Load" Widget option (Editor Specific). The "Add" button will launch a builder to help you identify the available Related Data to load. Populated Related Data does NOT need its own DataSource, the Related Data is read and associated with the DataSource that you used with your Selection.