Constrain DATA sources for tables
  • 27 Sep 2023
  • 3 Minutes to read
  • Dark
    Light
  • PDF

Constrain DATA sources for tables

  • Dark
    Light
  • PDF

Article summary

In this tutorial we'll show you how to set constraints on data sources for tables, using features such as filter, sort, limit, and offset. These will help you to define how your data will be listed on the template.

By creating one or more data source from one table, you can use one table as separate lists on one template.

Imagine the Use case that you have one Beverages table created on the Tables tab and on your Template you want to show separately hot and cold drinks. So you create two data sources, one filtered on hot and the second on cold beverages.

Topics covered:
Data sources tab - Tables type: 
  • Filter, sort, 
  • Limit and 
  • Offset functions

    


TUTORIAL STEPS:

Prerequisite
A) Open on the Data source tab an existing item. 

B) Adding filter
The following function filters rows of a table based on the set value in the specified column. Filtering occurs before sorting, offset, and limit are applied. You may add multiple filters.

  1. Click the Add filter button. 
  2. Select the filter type.

Note: You can set "AND" or "OR" type of logical operator to each individual filter. In case of multiple filters added, all filters of "AND" type will be "anded" together, then each single "OR" filter type will be "ored" with the result of the "AND" filters.
C) Adding filter

  1. Select a Column from the drop-down menu with a list of table column names. Rows of the table will be filtered based on the values in the column specified here. 
  2. Select the Value type.
  3. Set the Value.

Value types:

  • Fixed value - by selecting this option, you can manually enter a static/fixed value in the Value field.
  • Display custom field - by selecting this option, you can select a Display Custom field/Аsset in the Value field, allowing you to set individual values for each display on the Displays tab.


D) Adding sort
The following function sorts rows of a table by the specified column. This function sorts the result rows after filters are applied and before the offset and limit is applied. You may add multiple sorts.

  1. Click the Add sort button. 
  2. Select the order in which a particular sort is applied. Only sorts with an order of 1 to 9 are allowed.
  3. Set the sort type to Ascending or Descending order. Ascending order means from smallest to largest (0 to 9) or from first to last (A to Z). Descending order means from largest to smallest (9 to 0) or from last to first (Z to A).

E) Adding sort
 
  1. Select the Value type.
  2. Set the Value. Rows are sorted by the values of the selected column here.

Value types:

  • Fixed value - by selecting this option, you can manually enter a static/fixed value in the Value field.
  • Display custom field - by selecting this option, you can select a Display Custom field/Аsset in the Value field, allowing you to set individual sort values for each display on the Displays tab.


F) Adding limit
The following function limits the number of table rows displayed. You may add only one limit.

  1. Click the Add limit button. 
  2. Select the Value type. 
  3. Set the limit (number of rows displayed) in the Value field.

Value types:
  • Fixed value - by selecting the Fixed value option, you can manually enter a static/fixed value in the Value field. 
  • Display custom field - by selecting the Display custom field option, you can select a Display Custom field/Аsset in the Value field, allowing you to set individual limit values for each display on the Displays tab.
G) Adding offset
The following function lets you choose how many rows from the start of the table you want to skip. Only one offset function may be added.

  1. Click the Add offset button. 
  2. Select the Value type.
  3. Set the Value. The number entered into the Value field specifies how many rows from the start of the table should be skipped. If the value is greater than the number of rows filtered, then no rows are displayed. 
Value types:
  • Fixed value - by selecting the Fixed value option, you can manually enter a static/fixed offset value in the Value field. 
  • Display custom field - by selecting the Display custom field option, you can select a Display Custom field/Аsset in the Value field, allowing you to set individual offset values for each display on the Displays tab.

H) Preview the output of you data source configuration with assigned display configuration to see how the specific custom field values chosen in your display's configuration affect the outcome.


  1. Click the Select custom field values from display button and select a display configuration. 
  2. Click on the "magnifying glass" button to open the data output in JSON format in a new browser window.


I) Click the Save button.

The constrained data source for your table is created and you can use it in your templates. 



Was this article helpful?