Skip to main content

Date

Usage

A Date filter is a UI control for selecting a single date (year, month and day).

image-300 image-300

The filter is used in a condition on a date SQL expression (e.g. column).

Syntax
{[<date_expr>]=<filter_variable_name>}

The <date_expr> must either be an expression of type DATE or an expression that can be cast to a DATE. The filter input values that the expression is compared to are always represented by Cluvio as date literals, as in DATE '2023-04-12'. For example, the parameterised SQL query

SELECT *
FROM logs
WHERE {log_date=my_date_filter}

with a selected input date of 2023-04-12 would result in database-specific SQL similar to the following:

SELECT *
FROM logs
WHERE log_date = DATE '2023-04-12'

Configuration

To configure a Date filter, select Date as the UI control type in the filter definition dialog.

Edit Filter Edit Filter

The Value Type of a date filter is always Date and the input values are validated and represented in SQL accordingly.

Open the Configuration tab to set a default value and further configuration options.

Value Selectors

A value selector allows to tap into SQL value expressions associated with the selected date.

Date Value

SELECT {my_date.value}

The .value selector produces a database-specific date value expression or NULL if no value is selected.

Selected

SELECT *
FROM event
WHERE
CASE
WHEN {my_date.selected} = TRUE THEN {starttime=my_date}
ELSE starttime = DATE '2024-01-01'
END

The .selected selector produces a database-specific boolean expression that is true when a value is selected for the filter, false otherwise.