The Data Modeler is a special area of Layout Designer for describing the Layout Data Model.
Data Model is a unified set of various data which are required for the Layout rendering and execution. The whole Data Model represents the collection of Data Sources, each of them is a portion of data obtained from one single source (e.g. from Web Service response, or from single SQL query execution, or Data Layer request) in scope of the one transaction (request). By defining the right Data Sources with the right scope, it is possible to achieve dynamic Layout Data Model, which dynamically actualizes only minimal Model scope (only one Data Source) , without reloading the whole Model.
Besides the declaration of Data Sources, the main purpose of the Data Model is to setup relations between Data Sources, and define rules of how the Data Sources are changed (updated) depending on various conditions, such as user input or received data from another Data Source.
Each Data Source, regardless of its type, has input (1), output contacts (3), and system properties (2).
The input contact is a list of Data Source properties which defines the Data Source data. They are similar to input arguments of a function, or query parameters of the SQL Query. Once the input contact (at least one) is changed, the System invalidates the related Data Source and tries to reload the relevant data for new input arguments, or, in our example, once the categoryId is changed, it causes the whole Data Source reload, and as a result of the update of the output properties Priority and Summary to corresponding values.
Data Source System Properties
Integer. Signals the current state of the Data Source.
1 - loading, the request to obtain data has been sent, but no data received yet;
2 - loaded, the data relevant to current input contact are loaded to output contact;
3 - rejected, the failed state of Data Source, means the Server reject the request for data
|$inactive||Boolean. Gets or sets the availability of the Data Source. If True, no requests are sent to Server to actualize the Data Source, regardless of changing the input contact|
Using $inactive attribute can help in cases when the Data Source has a lot of input properties, and setting them is a step-by-step interactive process (e.g. Wizard steps). To avoid multiple requests, a Server provoked by any single change, it makes sense to deactivate Data Source on the begging, and make it active again when all properties are set.
Data Source Property
A Data Source consists of a list of Properties, each of them could be bound with some UI control property, or with another Property in data model.
Click on a property to display the available artifacts at the bottom of the Data Model view:
|Title||Localized display name of the Property. Present only in cases when the related Data Source provides such metadata description. E.g. "Data Definition" or "Entity" Data Sources are extracting this information from Schema metadata, and delivers these data to Solution Builder.|
|Type||Indicates the data type of the Property. The Type is used to build a relevant list of properties available in Layout Designer. E.g. on binding the Data Model Property to DateTime Picker control value, only properties with type Date Time will be available.|
|Reference||Describes the Database relation Data Definition. Available only for properties associated with the Schema Relation or Pickup value.|
|Direction||Describes the purpose of a property. IN - signals the property is input contact of a Data Source, OUT - shows the value of the property is obtained from Server.|
Changing Property value
Model-View-Controller pattern used in Layout Designer presumes the Data Model in any single moment of time is up-to-date and does not require additional preparations to be submitted. It means the System should react to all possible events, like User interaction or some Service response, appropriately and immediately actualize the whole Data Model to bring it to normal state.
There are several ways how the System can affect the Property value:
1. User interaction (input)
Place an input control on Layout Designer Canvas and bind the control output value with the appropriate Data Model Property. Once the user opens the Layout and starts entering data into the control, the provided changes are immediately reflected in the Data Model property value.
2. Data Source reload
Changing the DataSource input contacts causes the reload of the whole Data Source and update of all Output properties
3. Associate the Property with another Property
The System allows to setup a relation to another Property. Once the associated property is changed, it immediately changes the Property value. For example, in Wizards the property Context.ObjectIds keeps the IDs of the selected Objects for which the Wizard is started. The Wizard on submits calls a Web Service which as input contact has an array of affected object ids. In this case the WebService.IDs property can be easily associated with Wizard Context.ObjectIds.
To setup a relation:
- Select the Property in Data Modeller you would like to associate.
- Click "Edit" in Property details view.
- In the Dialog that appears, click the "TAKE VALUE FROM" button and pick the needed property.
4. Calculated Property
In many cases, the value of the property depends on values of several related variables, and needs additional calculations. For all such cases, the Advanced Mode of the Calculated Property can be used. Just like for the "Associate Property" (1) case, you need to select the Property the value of which needs to be moderated, and click the "EDIT" action for it. At the top of the dialog, select the “Advanced Mode” radio button.
In the picture above, the example of the definition of the eMail property is present. The value of that Property relies on values of two other Properties, FirstName and LastName. Use the ADD button (2) to add new relations to other properties.
See also Methods in Calculated Fields page.
Data Source Types
Solution Builder provides a wide range of various kinds of Data Sources which allow to incorporate the data into the Data Model from different sources. At that moment, you have the following options:
Entity (Configuration Item) Data Source
Add a single object of the specified Configuration Item to the Data Model.
Data Definition Data Source
Web Service Operation Data Source
Data Query Data Source
The Data Source uses the specified Data Query contracts for retrieving data. Regardless from the specified Data Query the Data Source has the following input and output parameters:
|ObjectId||Id of the Object. If set, the data source returns only one record, for the specified object|
|FragmentIds||Array of the fragment ids of the specified Data Query Data Definition. When defined, the Data Source returns only records with the defined ids|
Defines the filtering expression for the Data Source. The format of the expression is varies depends on the type of the Data Query. If Data Query is based on Data Definition, then the filter language is A-SQL.
In case Data Query type is SQL Query, then $filter has to be T-SQL WHERE clause, and only Data Query defines column names can be in filter. The System allows only simple conditions without sub-queries, or calling stored procedures, as well, the Data Query SQL Query should be just a single SELECT statement (without other operators like DECLARE, SET, WITH)
Setups paging for the Data Source output. When set only data of the defined page in the amount of $pageSize will be returned
|$totalCount||Output. Returns the amount of data records which match the Data Source filtering criteria (regardless the paging configuration)|
|$first||Represents the first record of the Data Source output.|
|$return||Data Source output. Array of objects.|
Context Data Source
Is a predefined Data Source the single instance of which is present in Layout Template of any kind. By default, the Context provides a set of Environment variables which can be useful for Layout authoring.
Context Predefined Properties
|CurrentUser||ID of the interactive user|
|ApplicationName||Technical name of the active UUX Application|
|OutterContext||Provides a possibility to get context data from the opener Layout. For example, on running action from multiselection in grid, the OutterContext keeps the array of the selected objects|
|ObjectIds||The IDs of the Objects available in the Context. Mostly used in Wizards started by Actions. The IDs selected object/-s for which the action is activated are present in ObjectIds Property|
|Object||Provides the information for the Action context object.|
Represent the whole information available in browser about the context object.
The Structure of the ObjectReference is varying from the way the Action is triggered. If the Action started from the Preview, then Object Reference keeps the Entity Object available on Preview, if the action starts from the Grid, the Object Reference keeps the Grid record
|NavigationId||ID of the active Navigation Item (PDRNavigationItemClassBase.ID). The Property can be used to differentiate the logic of the same Layout depending on Navigation Item (management area) the layout has been openned|
|FilterId||Fragment ID (PDRDataQueryClassFiter) of the active Filter in Navigation. If no Filter is currently selected then the property value is null.|
The Modeler provides a set of Actions which allow changing the Data Model structure and setup dependencies
Adding and Editing Data Source
For the cases when the Data Model does not contain the data required for Layout, the action "+ADD Source" allows to incorporate additional Data Source, which delivers the required data. To start action, click "+ADD SOURCE" button on the bottom of the Data Modeler.
To edit already present Data Source, press the gear next to Data Source name in Data Model tree.
Source Name, the name of the Data Source in Data Model tree. The name needs to be unique among others declared Data Sources.
Source Execution Mode, in combination with Data Source property $sourceState, specifies the way how the Solution Builder loads/reloads the data for the Data Source. The property has the following options:
- None, the data is not loaded
- On Init, the Data Source data loaded only on loading/opening the layout.
- On Data Update, defines to load/reload the data anytime the input parameters of the Data Source is changed. This data source is not loaded on Layout initialization, and only when input parameters will be updated after the form is fully loaded.
- On Init and Data Update, aggregates both previous options, and load the data on initialization of the Layout, and also on changing the input properties.
- On Saving, the option available only for Dialog Layouts, and trigger the Data Source execution right before the object is being saved.
- On Saved, the option available only for Dialog Layouts, and trigger the Data Source execution right after the object is saved.
Overwrite source results data after reloading, solves the ambiguity which appears on Data Source reloading when the current data source data, which been loaded previously or provided manually via bound controls, need to be either merged or overwritten.
Source is used for download, signals the System that the Data Source response is a file, which could be downloaded
Reload data source every, activates the automatic renewal of the Data Source within defined time interval (amount of seconds).
Implementation, specify the Data Source type, associated with Data Source. Depending on the selected type, the form request to pick required parameters for selected Type. E.g. for Service Operation, the concrete Web Service Operation; for the selected type Data Definition, the specific Data Definition need to be picked and also classify how many records the Data Source returns, either a Single or Multiple
Delete or fix Data Source with the removed Implementation
In case the Data Source Implementation is not present anymore for whatever reason, like the related Web Service, Data Query, Data Definition or Configuration Item was removed, the Data Source is highlighted in Data Model tree. See the picture below.
Such corrupted Data Source could be either manually removed by clicking the Cross or restored by entering to Edit mode and selecting a new Implementation. Also, all calculated fields will be saved in the removed Data Source and will be applied to the new Data Source.