Button Group
Creates a group of single-select buttons for quick filtering
To see how to filter a query using a Button Group, see Filters.
<ButtonGroup data={query_name} name=name_of_button_group value=column_name />
Examples
Button Group using Options from a Query
<ButtonGroup data={query_name} name=name_of_button_group value=column_name />
With a Title
<ButtonGroup data={query_name} name=name_of_button_group value=column_name title="Select a Category" />
With a Default Value
<ButtonGroup data={query_name} name=name_of_button_group value=column_name title="Select a Category" > <ButtonGroupItem valueLabel="All Categories" value="%" default /> </ButtonGroup>
Note that "%" is a wildcard character in SQL that can be used with where column_name like '${inputs.name_of_button_group}'
to return all values.
With Hardcoded Options
<ButtonGroup name=name_of_button_group> <ButtonGroupItem valueLabel="Option One" value="1" /> <ButtonGroupItem valueLabel="Option Two" value="2" /> <ButtonGroupItem valueLabel="Option Three" value="3" /> </ButtonGroup>
Alternative Labels
<ButtonGroup data={query_name} name=name_of_button_group value=column_name label=column_name_containg_label />
Filtering a Query
<ButtonGroup data={query_name} name=name_of_button_group value=column_name /> ```sql filtered_query select * from source_name.table where column_name like '${inputs.name_of_button_group}' ```
ButtonGroup
Options
name
REQUIRED
Name of the button group, used to reference the selected value elsewhere as {inputs.name}
preset
Preset values to use
- Options:
- dates
data
Query name, wrapped in curly braces
- Options:
- query name
value
Column name from the query containing values to pick from
- Options:
- column name
label
Column name from the query containing labels to display instead of the values (e.g., you may want to have the drop-down use `customer_id` as the value, but show `customer_name` to your users)
- Options:
- column name
- Default:
- Uses the column in value
title
Title to display above the button group
- Options:
- string
order
Column to sort options by
- Options:
- column name
- Default:
- Uses the same order as the query in `data`
where
SQL where fragment to filter options by (e.g., where sales > 40000)
- Options:
- SQL where clause
ButtonGroupItem
The ButtonGroupItem component can be used to manually add options to a button group. This is useful if you want to add a default option, or if you want to add options that are not in a query.
Options
value
REQUIRED
Value to use when the option is selected
valueLabel
Label to display for the option in the dropdown
- Options:
- string
- Default:
- Uses value
hideDuringPrint
Hide the component when the report is printed
Options:
- Default:
- true