Skip to content

Datasets with patameters

Datasets with parameters in Flowtrail AI enable you to create dynamic queries that can adapt to varying criteria, enhancing flexibility and precision in data retrieval. Configure parameters such as string, number, boolean, date, select, multiselect, and SQL query to tailor your dataset queries to specific needs. Each parameter can be customized with variable names, default values (if needed), and optional requirements. To add parameter in your query click on add parameter button from dataset page

add-parameter

Parameter Configuration

Clicking on the “Add Parameter” button will open a form where you can select from various parameter options. Flowtrail AI currently supports the following parameter types, each with customizable properties

parameter-form

Type of parameters

  • String

    String parameter allows you to input text or alphanumeric characters. This parameter type is versatile for filtering or searching datasets based on textual criteria.

  • Number

    Number parameter allows you to input numerical values. This parameter type is ideal for filtering or analyzing datasets based on numeric criteria such as quantities, amounts, or measurements.

  • Boolean

    Boolean parameter provides a choice between two values, typically “true” or “false”. This parameter type is useful for filtering datasets based on conditions that require binary outcomes, such as yes/no or on/off states

  • Date

    Date parameter allows you to input a specific date or date range. This parameter type is essential for filtering datasets based on temporal criteria, such as transactions within a certain time period or events occurring on a particular date.

  • Select

    Select parameter allows you to choose a single option from a predefined list of choices. This parameter type is suitable for filtering datasets based on categorical variables where only one option is required.

  • Multiselect

    Multiselect parameter allows you to select multiple options from a predefined list of choices. This parameter type is ideal for filtering datasets based on categorical variables where more than one option may be relevant.

  • SQL

    SQL Query parameter allows you to input a custom SQL query directly. This parameter type is powerful for executing complex database queries within Flowtrail AI, allowing for highly customized data retrieval and manipulation based on specific SQL.

Parameter property

In Flowtrail AI, each parameter comes with specific properties that define its behavior and usage. Whether you’re setting up a string, number, boolean, date, select, multiselect, or SQL query parameter, understanding these properties ensures effective data handling and manipulation

  • Name

    Each parameter must be uniquely identified by a variable name. This name serves as a distinct identifier within your dataset configuration. For example, use “someVariableName” without spaces to ensure clarity and compatibility with dataset operations.

variable-name

  • Default value

    Optionally, you can set a default value for the parameter. This value will be used if no specific input is provided when executing the dataset query.

default-value

  • Required

    Specifies whether the parameter is mandatory for executing the dataset query. If marked as required, you must provide a value for the parameter before proceeding.

required

  • Select and Multiselect (Values Input)

    For select and multiselect parameters, input the available options separated by commas. These options form the selectable choices when users interact with the parameter.

select-values

  • SQL Query (Syntax Example)

    When using an SQL query parameter, ensure the syntax adheres to standard SQL format. Below is an example of how to structure an SQL query within Flowtrail AI:
example.sql
select displayName as label, valueName as "value" from table_name

This SQL query demonstrates how to retrieve data from a table. Replace table_name with the actual name of your table, displayName with the column representing labels or names, and valueName with the column representing values or identifiers.

For example: If you need to retrieve employee salary details based on specific employees from your database, you can integrate this query with parameters. Begin by creating a list of employees as parameters, then construct the query as follows:

example.sql
select employeeName as label, employeeName as "value" from employees

Integrate Parameters in Queries

Added parameters are conveniently listed at the bottom of the query editor interface, providing easy access and visibility. You have the flexibility to include multiple parameters in a single query, allowing for tailored dataset retrieval to meet precise criteria. Additionally, parameters can be edited or deleted directly from the list, empowering you to refine queries swiftly in response to evolving requirements or conditions.

added-parameters

Format for integration

To integrate parameters within your SQL query, use the following format:

example.sql
SELECT column1, column2 FROM table_name WHERE condition = '{{paramName}}'

Replace '{{paramName}}' with the actual parameter name defined in your parameter list. This syntax ensures that parameters are dynamically substituted with user-provided values at runtime.

Integration example

For instance, suppose you have parameters startDate and endDate representing a date range selected by the user. You can integrate them into your SQL query like this

example.sql
SELECT SUM(totalAmount) AS total_payroll
FROM employee_payroll
WHERE paymentDate >= '{{startDate}}'
AND paymentDate <= '{{endDate}}'

This query calculates the total payroll amount (total_payroll) from the employee_payroll table, filtering results based on the paymentDate within the specified date range provided by the startDate and endDate parameters.

Troubleshooting and Additional Help

If you have more questions about the parameters or encounter any issues, please join our Discord channel or Email us for support.