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).
In the picture above, the typical "GetCategoryInfo" Data Source which integrates the result of the Web Service execution to Layout Data Model is presented. In this case, the Data Source has only one property as Input contract (categoryId), and two properties Priority and Summary as output contract.
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 submit 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.
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|
|$filter||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.
Setups paging for the Data Source output. When set only data of the defined page in amount of $pageSize will be returned
|$totalCount||Output. Returns 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|