Filtering & Sorting
Last updated
Last updated
The filter appears in many elements in Kozmik that can display more than one record. Its purpose is to display your data in the interface by limiting it to the rules you set. For example, you could:
Filter items by Custom Value like text, number, and true/false.
Filter items by Screen (current record) data if you are in any details screen.
Filter items by User Profile data to show records created by the user.
Filter items by Relationships to show only related records.
List
Tile List
Calendar List
Choice
...and many more soon!
You can add a filter anywhere you see the Filter option or the +Add filter button. Within filters, you can use multiple rules on a list with AND + OR logic. For example, let's say you have a Candidate table and you want to turn it into a list, and it will be shown only candidates have "designer" or "developer" skills. In this case, you should have multiple rules in the filter and the logic should be OR.
There are several rule types, depending on the types of columns being compared.
equals: Checks if the field value equals the value. This operator can be used for all data types.
not equals: Checks if the field value is different from the value. This operator can be used for all data types.
contains: Checks if the value includes the field value. This operator can be used for text based data types and relation type.
not contains: Checks the value is not included in the field value. This operator can be used for text based data types and relation type.
is empty: Checks if the selected field is empty. This operator can be used for all data types.
is not empty: Checks if the selected field has a value. This operator can be used for all data types.
greater than: Checks if the field value is greater than the value. This operator can be used for date based types and number based types.
greater or equal: Checks if the field value is greater than or equal to the value. This operator can be used for date based types and number based types.
less than: Checks if the field value is less than the value. This operator can be used for date based types and number based types.
less or equal: Checks if the field value is less than or equal to the value. This operator can be used for date based types and number based types.
You can compare the field value to a custom value. For example, let's say you have a Product table and you store Stock Quantity in it. If you want to show only products that have a stock you should select the "Stock Quantity" field and the "greater than" operator then you can set 0 as the value. In this case, the list will be shown only products that have stock.
You can compare the field value to any value of the screen that has the same data type. For example, let's say you have Catalog and Product tables to present your catalog to your customers as hierarchical. When you are on the Category Detail screen you need to add another list element to this screen. And you should filter products by category that is on the detail screen. To do this, add a new filter to the products list and choose the relation column that is related to the category and select "equals" in operators, then select the "Screen" option in the dropdown. In this case, the product list will show only products related to the current category.
Another great feature is to filter data using User Profile data. This feature is important to provide your users with personalized experiences within the application. For example, let's say you are developing an event management application. You can filter the events attended by your users using the User Profile data and ensure that each user only sees their attended events.
The relation column is used to associate records from the same or different tables. The most important reason we use this structure is to avoid repetitive data and to work with structurally well-designed data models. The relation column can accept single or multiple values, and this is a definition selected when adding the column.
There are several ways to filter relation columns;
With another "Relation" column: This allows you to filter the selected relation field to another.
With "Screen" data: This allows you to filter the selected relation field by any field of Screen. You can use this feature to filter items by current Screen.
With "Custom" values: This allows you to filter the selected relation field by custom values. If the value field has a "Relation" data type, you will see a dropdown as an input area that has only target relation values. For example, let's say you have members and member types tables. The Member Types table has two records, Trainee and Trainer. And you marked every member as a trainer or trainee using the by Relation column. If you want to show only trainers in a list you should add a filter for the relation column and choose the trainer option in values from the input.
The sort appears in many elements in Kozmik that can display more than one record. Its purpose is to sort your data in the interface by the rule you defined. It has a default rule to sort ascending by Name (auto-generated field). You can change the default rule by selecting a different column and sorting type. For example, let's say you have a "Product" table and you store the "Stock Quantity" with a column here. If you want to list the products that have the most stock in the first place in the list, you should select the "Stock Quantity" column and the "Descending" sorting type in the sorting options.