Dropdown

Creates a dropdown menu with a list of options that can be selected. The selected option can be used to filter queries or in markdown.

To see how to filter a query using a dropdown, see Filters.

Selected: Sinister Toys

<Dropdown 
    data={categories} 
    name=category1 
    value=category_name 
    title="Select a Category" 
    defaultValue="Sinister Toys"
/>

Examples

Selected: Sinister Toys

<Dropdown 
    data={categories} 
    name=category2 
    value=category_name 
/>

With a Title

Selected: Sinister Toys

<Dropdown 
    data={categories} 
    name=category3 
    value=category_name 
    title="Select a Category" 
    defaultValue="Sinister Toys"
/>

With a Default Value

Selected: Odd Equipment

<Dropdown
    data={categories} 
    name=category4
    value=category_name
    title="Select a Category"
    defaultValue="Odd Equipment"
/>

With Hardcoded Options

Selected: 1

<Dropdown name=hardcoded>
    <DropdownOption valueLabel="Option One" value="1" />
    <DropdownOption valueLabel="Option Two" value="2" />
    <DropdownOption valueLabel="Option Three" value="3" />
</Dropdown>

Alternative Labels

Selected: Sinister Toys

This example uses a column called abbrev, which contains an alternate label for each category

<Dropdown
    data={categories} 
    name=category_abbrev
    value=category_name
    label=abbrev
/>

Multi-Select

Selected: false

<Dropdown
    data={categories} 
    name=category_multi
    value=category_name
    multiple=true
/>

Filtering a Query

Starting with this table of orders:

No Results

Use this input to filter the results:

Filtered Row Count: 0

Data Table
Parser Error: syntax error at or near "false" LINE 4: where category in false ^
<Dropdown
    data={query_name} 
    name=name_of_dropdown
    value=column_name
/>

```sql filtered_query
select *
from source_name.table
where column_name like '${inputs.name_of_dropdown.value}'
```

Multiple defaultValues

Selected: ('Mysterious Apparel','Sinister Toys')

<Dropdown
    data={query_name} 
    name=name_of_dropdown
    value=column_name
    multiple=true
	defaultValue={['Sinister Toys', 'Mysterious Apparel']}
/>

Select all by Default Value with Multiple

Selected: ('Cursed Sporting Goods','Mysterious Apparel','Odd Equipment','Sinister Toys')

<Dropdown
    data={categories} 
    name=category_multi_selectAllByDefault
    value=category_name
    title="Select a Category"
    multiple=true
    selectAllByDefault=true
/>

Select and return all values in the dropdown list, requires "multiple" prop.

Dropdown

Options

Required
Name of the dropdown, used to reference the selected value elsewhere as {inputs.name.value}
Query name, wrapped in curly braces
Options:
query name
Column name from the query containing values to pick from
Options:
column name
Enables multi-select which returns a list
Options:
Default:
false
Value to use when the dropdown is first loaded. Must be one of the options in the dropdown. Arrays supported for multi-select.
Options:
value from dropdown | array of values e.g. {['Value 1', 'Value 2']}
Selects and returns all values, multiple property required
Options:
Default:
false
Stops any default from being selected. Overrides any set `defaultValue`.
Options:
boolean
Default:
false
Removes the `Select all` button. Recommended for large datasets.
Options:
boolean
Default:
false
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 to display above the dropdown
Options:
string
Column to sort options by, with optional ordering keyword
Options:
column name [ asc | desc ]
Default:
Ascending based on dropdown value (or label, if specified)
SQL where fragment to filter options by (e.g., where sales > 40000)
Options:
SQL where clause
Hide the component when the report is printed
Options:
Default:
true

DropdownOption

Options

The DropdownOption component can be used to manually add options to a dropdown. This is useful to add a default option, or to add options that are not in a query.

Required
Value to use when the option is selected
Label to display for the option in the dropdown
Default:
Uses the value