A collection variable is a placeholder for a "collection of records" which belongs to a chosen data model. To use this variable, you first need to create a data model, or table, inside the Dittofi Data Models tab. The screenshot below shows a data model called "Products" that we will use in this example.

To populate the collection variable with the records from your data model, you need to declare the collection variable. Next, complete the four steps.

Step 1: Set the variable type to collection

Pick the variable type collection from the drop down inside the "New Variable" browser.

Step 2: Set the label and name

Input values into the label and name fields.

  • The name given to the variable is the name that will be presented in the final generated code. This means that it cannot take certain values such as numbers, punctuation and special characters.

  • The label of the variable is used by the system to display body, header, path and query. This is different from the name since it can take number values, punctuation and special characters. Unless you have a specific reason for wanting to set this value, you can leave it the same as the name.

Step 3: Choose a filter type

The filter type lets you specify how you want to filter for records in your associated data model. For example, let's say we want to filter for all products in the Products Data Model where the Category is is equal to Science.

Each of the different filter types lets you filter for data in more advanced and granular ways. The filter types are:

  • Basic filter: the basic filter allows you to build up a filter, or query, that will execute against the chosen data model. The filter is built up using the the visual editor. This filter type is the simplest to understand and is made available by default. Using the basic filter, you can choose which rows are returned from a particular data model, but not which columns.

  • Advanced visual filter: this filter type allows you to perform more advanced filters, for example, running a filter that joins multiple data models together in a single request. This filter type allows you to filter for both a subset of rows in a single or multiple data models, as well as a subset of columns.

  • Custom query: The custom query gives more technical people the opportunity to write a custom query.

  • No filter: the option to set no filter lets you put all data from your data model inside your collection variable.

Step 4: Choose a data model

Next, you can associate the variable with one of your data models or custom data models. Once you have selected a data model to associate with your variable, different options will be made available.

Setting up a basic filter

To set up a basic filter, you need to (1) decide which records you want to filter for and (2) how you would like to store these records in your collection variable.

What data to filter for?

Which data you want to filter for in your associated data model, is controlled by the where clause.

Storing records

How you want to store the records in your data model is controlled by the order by, limit, offset and max record options.

Last updated