Skip to content

Using report filters with notebooks

Report filters can be accessed from code when a variable name has been specified for the filter.

The filter variable is reactive and will recompute data when filter values are changed.

Object formats

The filter object contains information about the filtered columns (if any) as well as the type of filter and the filter values.

The filter value structure is a bit different depending on the type of filter. Date ranges have a start and end data specified (as Moment.js objects).

{
  "columns": [
    {
      "caption": "Tournament Date",
      "table": "tennis",
      "column": "tourney_date",
      "schema": "@rational/tennis",
      "type": "date"
    }
  ],
  "type": "daterange",
  "startDate": "2020-08-31T22:00:00.000Z",
  "endDate": "2020-09-30T21:59:59.999Z",
  "label": "this_month"
}
{
  "columns": [
    {
      "caption": "Surface",
      "table": "tennis",
      "column": "surface",
      "schema": "@rational/tennis",
      "type": "text"
    }
  ],
  "type": "text",
  "value": "US Open"
}
{
  "columns": [
    {
      "caption": "Winner Rank",
      "table": "tennis",
      "column": "winner_rank",
      "schema": "@rational/tennis",
      "type": "number"
    }
  ],
  "type": "number",
  "value": "29"
}