Hi,
I have multiselect input and here's the code"
<label>Type</label>
<delimiter> </delimiter>
<choice value="*">All</choice>
<default>*</default>
<initialValue>*</initialValue>
<fieldForLabel>Ticket Type</fieldForLabel>
<fieldForValue>Ticket Type</fieldForValue>
<search base="baseSearch">
<query>| stats count by "Ticket Type"</query>
</search>
It generates to values, "Incidents" and "Service Request".
And using the token, I was able to pass the value to the title of a panel.
Now, what I'm trying to do is to pass the static label, which is the "All" to the title of the panel as well.
How will I able to do that?
@jvmerilla, Dropdown input has default tokens $value$
and $label$
available within the dropdown's change event handler
. You need to add the following code to pass on the dropdown label as token.
<change>
<set token="tokLabel">$label$</set>
</change>
Following is a run anywhere dashboard example:
<form>
<label>Label for Title</label>
<fieldset submitButton="false">
<input type="dropdown" token="tokType" searchWhenChanged="true">
<label>Type</label>
<choice value="*">All</choice>
<choice value="Incidents">Incidents</choice>
<choice value="Service Request">Service Request</choice>
<default>*</default>
<change>
<set token="tokLabel">$label$</set>
</change>
</input>
</fieldset>
<row>
<panel>
<title>Dropdown Label is $tokLabel$</title>
<table>
<search>
<query>| makeresults
| eval value="Token value is: $tokType$"
| fields - _time</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
<sampleRatio>1</sampleRatio>
</search>
<option name="count">20</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="rowNumbers">true</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
</panel>
</row>
</form>
PS: You should check out Splunk Dashboard Examples App for Input Multi-token Setter
example.
To store all selected labels of a multiselect input as a comma-separated list, not just the first one, you could for example use:
<change>
<set token="tokLabel" delimiter=",">$label$</set>
</change>
prefix=""
and suffix=""
are also valid attributes in <set>
@jvmerilla, Dropdown input has default tokens $value$
and $label$
available within the dropdown's change event handler
. You need to add the following code to pass on the dropdown label as token.
<change>
<set token="tokLabel">$label$</set>
</change>
Following is a run anywhere dashboard example:
<form>
<label>Label for Title</label>
<fieldset submitButton="false">
<input type="dropdown" token="tokType" searchWhenChanged="true">
<label>Type</label>
<choice value="*">All</choice>
<choice value="Incidents">Incidents</choice>
<choice value="Service Request">Service Request</choice>
<default>*</default>
<change>
<set token="tokLabel">$label$</set>
</change>
</input>
</fieldset>
<row>
<panel>
<title>Dropdown Label is $tokLabel$</title>
<table>
<search>
<query>| makeresults
| eval value="Token value is: $tokType$"
| fields - _time</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
<sampleRatio>1</sampleRatio>
</search>
<option name="count">20</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="rowNumbers">true</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
</panel>
</row>
</form>
PS: You should check out Splunk Dashboard Examples App for Input Multi-token Setter
example.
Thank you so much
The only problem with using $label$ token with multi-select is that it only displays the first element, Is there a way to display all labels separated by a comma without using any javascript?
i also have the same issue, with mulitselect how to show all the fields label seelcted