Calling an input value from a widget
Introduction
Both types of inputs can be used as variable elements for widgets. The widget's query must reference the required input through a script placed in the part of the query you want to substitute with the input values. This script consists of the input ID and the value suffix joined by a dot (InputID
.value)
and can be accompanied by an operator depending on the function the input values fulfill inside the query.
All widget and input ID values are assigned automatically and can be read in the Data settings of the widget or input element.
Depending on the data to be entered in the input and their function inside the widget query, you can use the following types of expressions and operators:
query(InputID.value) | |
---|---|
Use this expression in the widget query as a placeholder for whole queries. Example
| Enter the required query in the input and the widget will display the query results. In the example on the left, a valid option would be:
|
$InputID.value | |
Use the Example
| Enter the required filtering options in the input and the widget will display the result of the filter operation. In the example on the left, some valid options would be:
|
$*InputID.value | |
Use the Example
| Enter the required query part or field in the input and the widget will display the results. In the example on the left, some valid options would be:
|
These expressions will make your widgets show data according to the content introduced in the inputs referenced in their queries, however, they will not show anything until the input contains valid values. If you want them to show content prior to manual selection, you can further configure them as explained in the following article: Show data in widgets before entering values in inputs
Examples
You can use multiple inputs simultaneously to generate a widget able to display different sets of data with just a few clicks. Below are some examples that may help you better understand the potential of inputs.
Use the following query in a table widget to create a dynamic table that allows you to specify the source data table, the grouping period, and the grouping key. The table is linked to three different Select-type inputs populated with the values shown below.
Select0
Select1
Select2
The following capture shows the table after selecting demo.ecommerce.data as source table, 1s as grouping time and statusCode as key column for the grouping. Use the following query to feed a column widget to display the count of status codes greater than a specified value and grouped by a period selected from a list of values. The Select-type input is populated with the values shown below.
Select0
Input0
The following capture shows the column widget after entering 5m in the free-text input as grouping period and selecting 400 in the select input as filtering value, so that only status codes greater than 400 are shown in each five-minute period. You must select the count field as the Y-axis value and add the statusCode column as a series in the Visual settings of the column widget. |