Dynamic Filtering

Overview

Dynamic filtering is the process of applying flexible and dynamic conditions to queries, allowing the filtering criteria to be determined at runtime rather than being hardcoded.


Dynamic Filtering vs. Normal Filtering

Feature
Normal Filtering
Dynamic Filtering

Criteria Definition

Hardcoded in the query

Determined at runtime

Flexibility

Limited

High

Use Case

Fixed filtering requirements

Context-dependent or user-driven

Example Input

WHERE active = 1

WHERE {{column}} {{operator}} {{value}}

Query Modification

Requires query rewrite

Adapts without rewriting


Key Benefits of Dynamic Filtering

  1. Customizable Queries: Users can define their own filter conditions through UI inputs or API parameters.

  2. Efficiency: Single API endpoint can handle multiple filtering scenarios without requiring changes to the backend logic.

  3. Scalability: Easily integrates with complex filtering requirements for large datasets, like filtering products in an e-commerce store.

Implementation

In the filter pop up box, click on the rule button

Choose the column and desired operator for performing filteration, then change the static option to dynamic in the dropdown. The example show below is for displaying the query where customer_id is equal to the value provided

Now click on the save button

Testing the URL Endpoint

Copy the endpoint URL from the top right box in the REST APIs page

Then open postman, and paste the URL into the input bar

Next we click on the "Params" tab and then enter a param for the column we set up filtering on (here, customer_id) and assign a value.

Now we hit the send button next to the input bar to make the request, and we receive the following response as expected

Last updated