Skip to main content

Constants Fields - Collection

Allows you to apply a constant or fixed value to filter the data entries.

Remember, once, a constant is created, it is added to a filter condition.


1. Accessing the Constants

To access Constants settings, go to the Collection panel in the left toolbar of the builder. Open the settings of the collection in whose fields you want to add constants and select the "Constants" category to access "constants" settings.

DrapCode Builder Collection Constants

2. Adding a Constant

To add a constant follow these steps:

Step 1: Create a Constant

To create a Constant open the Constants settings of a collection and add the name and type of the constant as well as the value to be applied on it. Then, click the Create Constant button.

In the example below, a constant is created on the String field for gender with the constant value as Female.

DrapCode Builder Collection Constants

Step 2: Apply the Constant to a Filter

Now, go to the Filters settings of the same collection and add a Equals condition on the Gender field of the collection with the constant value.

In the example below a filter is created to sort data on the basis of the gender field to find all entries in the data table where gender equals Female (constant value).

DrapCode Builder Collection Constants

Step 3: Bind the Collection & the Filter

Now bind the collection to a data table or any other valid component and apply the filter previously created on it.

DrapCode Builder Collection Constants

Step 4: Preview or Publish

Open the page containing the Data Table in the preview or published mode to see that the table displays only those entries that contains the set constant value, i.e. Female gender in the example below.

DrapCode Builder Collection Constants