Query Data

Action ID: query_data

Description

Query, filter, and sort rows in a dataset with advanced filtering capabilities.

Input Parameters

Name
Type
Required
Default
Description

dataset

dropdown

βœ“

-

The dataset to query.

conditions

array

-

[]

List of filter conditions (empty = return all rows).

logic

dropdown

-

and

How to combine conditions (AND/OR). Options: and, or

select_columns

multi-select dropdown

-

[]

Columns to return in results (empty = return all columns).

sort_by_column

dropdown

-

null

Column to sort results by (must be in selected columns if specified).

sort_order

dropdown

-

asc

Ascending or descending order. Options: asc, desc

limit

integer

-

100

Maximum number of rows to return (1-1000).

Filter Condition Structure

Each condition in the conditions array contains:

Field
Type
Description

column

string

Column name to filter by

operator

dropdown

Comparison operator: equals, not_equals, contains, greater_than, less_than, in

value

string

Value to compare against. For 'in' operator, provide comma-separated values or JSON array

chevron-rightView JSON Schemahashtag

Output Parameters

Name
Type
Description

rows

array

The rows that match the query criteria.

total

integer

Total number of matching rows (before limit).

chevron-rightView JSON Schemahashtag

How It Works

This node performs advanced filtering and querying on dataset rows. It applies filter conditions using the specified logic operator (AND/OR), supports multiple comparison operators, allows column selection for optimized data retrieval, and provides sorting capabilities. The node returns both the filtered rows and the total count of matching records, enabling pagination and result analysis.

Usage Examples

Example 1: Query All Rows

Input:

Output:

Example 2: Filter by Single Condition

Input:

Output:

Example 3: Multiple Conditions with AND Logic

Input:

Output:

Example 4: Using IN Operator

Input:

Output:

Input:

Output:

Common Use Cases

  • Data Retrieval: Fetch specific records from datasets based on business logic

  • Search Functionality: Implement search features using contains operator for text matching

  • Analytics and Reporting: Extract filtered data subsets for analysis and visualization

  • Data Export: Query and prepare data before exporting to external systems

  • Workflow Triggers: Find records matching specific criteria to trigger downstream actions

  • Pagination: Use limit and total to implement paginated data views in applications

  • Multi-Condition Filtering: Combine multiple filter criteria with AND/OR logic for complex queries

  • Sorted Results: Retrieve data in specific order for ranking or time-based analysis

Error Handling

Error Type
Cause
Solution

Dataset Not Found

Dataset ID doesn't exist

Verify the dataset ID is correct and the dataset exists

Invalid Column

Column name in condition doesn't exist

Check available columns in the dataset schema

Invalid Operator

Operator value not in allowed list

Use one of: equals, not_equals, contains, greater_than, less_than, in

Sort Column Not Selected

sort_by_column not in select_columns

Include sort column in select_columns or leave it empty

Invalid Limit

Limit outside 1-1000 range

Set limit between 1 and 1000

Empty Dataset

Dataset has no rows

Verify dataset has been populated with data

Invalid Logic

Logic value not 'and' or 'or'

Use either 'and' or 'or' for logic parameter

Malformed Condition

Missing required fields in condition

Ensure each condition has column, operator, and value

Notes

  • Performance: Use select_columns to retrieve only needed fields for better performance with large datasets.

  • Pagination: The total field shows all matching records, while rows respects the limit for pagination implementation.

  • Dynamic Dropdowns: The dataset, select_columns, and sort_by_column fields dynamically populate based on your available datasets and their schemas.

  • IN Operator Format: For the 'in' operator, values can be comma-separated ("val1,val2,val3") or JSON array format (["val1","val2","val3"]).

  • Empty Conditions: If conditions array is empty, all rows from the dataset will be returned (subject to limit).

  • Limit Range: Maximum limit is capped at 1000 rows per query for performance and resource management.

  • Case Sensitivity: The contains operator behavior may vary based on database configuration. Test with your specific dataset.

  • Null Values: Be aware of how comparison operators handle null values in your dataset columns.

  • Query Optimization: For frequently accessed queries, consider creating filtered views or using appropriate indexes on dataset columns.

Last updated