I am trying to get the the name of the token selected in the drop-down, and not the value.
The drop-down has a token name "dropToken" and has three choices aaa;bbb;ccc . The three choices have different values which I use in my search string. I am able to get the value of the choice by using $dropToken". Now I want to use the the token choice in the title of the panel. How can I get the token choice?
XML snippet
<label>Choose a Consumer</label>
<choice value="value specific to aaa">aaa/choice>
<choice value="value specific to bbb">bbb</choice>
<choice value="value specific to ccc">ccc</choice>
</input>
Now I want to take the value of the drop-down choice and use the same in the title of the panel, where this choice is used to derive the chart. like "chart for ccc"
Before closing out your </input>
area, add:
<change>
<set token="dropToken_label">$label$</set>
</change>
Then use $dropToken_label$ as your token for the label of $dropToken$
This WORKS! great
Frankly, I'd look here - http://docs.splunk.com/Documentation/Splunk/6.2.2/Viz/tokens#Access_labels_and_values_of_form_inputs
It shows you how to access input labels to use in titles.
Hi rajparekh08,
I understand that you want to use these values to display in the panel title. Well I can get them and display them in a table or chart, let me show it, may be someone can use it to finalise the answer.
1- after creating your dropdown with your choices (aaa=host, bbb=source,ccc=sourcetype ) and your token;
2- build your search string using eval command and if(). for example :
index=_internal |stats count|eval choice=if("$token$"="host","aaa",if("$token$"="source","bbb","ccc"))|table count choice
This display count and what we want to put in the panel title.
Hi rajparekh08
In your dropdown input add this
<default>*</default>
And define your panel title like this
<title> drop_Token="$drop_Token$" </title>
Hi rajparekh,
Try to add this code your mark < panel>
<title>$dropToken$</title>
my xml code is look like this :
<form>
<label>DashboardAn1</label>
<fieldset submitButton="false">
<input type="checkbox" token="categoryId" searchWhenChanged="true">
<label>Choose your CategoryId</label>
<prefix>(</prefix>
<suffix>)</suffix>
<valuePrefix>categoryId="</valuePrefix>
<valueSuffix>"</valueSuffix>
<delimiter>OR</delimiter>
<choice value="STRATEGY">aaa</choice>
<choice value="SIMULATION">BBB</choice>
<choice value="TEE">ccc</choice>
</input>
</fieldset>
<row>
<panel>
<title>$categoryId$</title>
<table>
<search>
<query>sourcetype="access_combined_wcookie" action=purchase $categoryId$|stats count by categoryId</query>
</search>
<option name="wrap">true</option>
<option name="rowNumbers">false</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">cell</option>
<option name="count">10</option>
</table>
</panel>
</row>
</form>