1. Home
  2. Docs
  3. Constructor of Model
  4. Operations templates
  5. Setup Data Sources and Items Source

Setup Data Sources and Items Source

Data Sources

When you need to get data from Registers or Catalogs, use Data Sources Expressions.


For example, we need to calculate the cost of Products in the row of the operation table. To do this, we need to get the balances of the Products and the value of Products in stock. And then, already having these data, we will be able to calculate the cost per unit of Products.


You can get an aggregated value from the Register’s data. And put it in the operation field (Header’s or Table’s).

It is important to understand that the data source configured for the field should return a value as a result, not a table or not a list. The data sources used to fill in the fields must end with Data aggregation functions or the Value function.

To get data in the operation field, enter the expression of the Data Sources which is extracting the necessary data. ( see Fig.1 )

Figure 1

During set up process and verify the correctness of the result, use Console and Data Source Constructor

Items Source

When you need to limit the list of items available for selection in the fields of the Catalog type use Items sources.

Items source is a Data source that returns the list of Catalog’s items available for selection in this field as a result.

For example, we need to select only the Customer of a certain Customer’s age.

Variables in Data sources and Items sources

You can use operation fields as variables in Data Sources or Items Sources.

When you need not fixed sampling values ​​in the expression of the Data source are needed, but a dynamic sampling, depending on user input, you can use variables.

Example:

Product | Store($h.store) | Product($r.product) | GroupBy(product, quantity, amount) | Compute(price, amount/quantity)

Variables $h.store and $r.product allow calculating the price of the product for a specific store and product selected by a user in Header’s and Table’s fields.