Example Usage
Suppose you want to create a query that retrieves information from an orders table, but you’re interested in a specific order ID. Instead of creating multiple queries for each ID, you can use a variable like so:copy
{{order_id}}
is a variable placeholder. When the query is run, the user is prompted to enter a value for order_id, which is then directly inserted into the query before execution.
Variable Types
Typper BI currently supports the following types of variables:- Date: For inputs that require a date value. Users can input dates through a date picker interface.
- Number: For numeric inputs. This can be useful for setting thresholds, limits, or specific numerical identifiers.
- Text: For string inputs. This is ideal for text-based queries, such as searching for a customer name or a product category.
- Boolean: For true/false inputs. This allows users to toggle conditions on and off, such as including or excluding certain data sets.
Implementing Variables
To implement a variable in your SQL query:- Determine the part of your query that will change based on user input.
- Replace that segment with a Handlebars.js variable syntax, e.g.,
{{variable_name}}
. - Specify the type of variable in the query or interface to ensure proper functionality.