Hi all,
I have a dynamic dropdown which has the values of a search result. I have a condition where i have to change the display name of one label without affecting the actual value. Does anyone has the solution for this?
Thanks in advance.
<panel depends="$UnlockAllCharts$">
<input type="dropdown" token="Tok_Unit" searchWhenChanged="true">
<label>Choose Software Unit</label>
<fieldForLabel>unit_label</fieldForLabel>
<fieldForValue>unit</fieldForValue>
<choice value="InitialValue">All</choice>
<default>InitialValue</default>
<initialValue>InitialValue</initialValue>
<showClearButton>false</showClearButton>
<search>
<query>index=abc source="*project.csv" | dedup unit| table unit | eval unit_label=if(unit="not defined","not categorized",unit)</query>
<earliest>0</earliest>
<latest></latest>
</search>
<change>
You have two fields available from the dynamic search to use in the dropdown. One is defined by <fieldForLabel> and the other by <fieldForValue>. Change the dynamic search to return appropriate pairs of label and value.
I have to change only one label name. Rest of the labels should be remained as such. I have a label named "not defined", in the dashboard i have to show it as "not categorized". But while that option is clicked it should pass value as "not defined" only. Do you have any solution for this?
In your search query
| eval label=if(value="not defined","not categorized",value)
Thank you.. I tried this but in the dashboard the vale is showing as "not defined" only.
Can you share your dashboard XML?
<panel depends="$UnlockAllCharts$">
<input type="dropdown" token="Tok_Unit" searchWhenChanged="true">
<label>Choose Software Unit</label>
<fieldForLabel>unit</fieldForLabel>
<fieldForValue>unit</fieldForValue>
<choice value="InitialValue">All</choice>
<default>InitialValue</default>
<initialValue>InitialValue</initialValue>
<showClearButton>false</showClearButton>
<search>
<query>index=abc source="*project.csv" | dedup unit| table unit </query>
<earliest>0</earliest>
<latest></latest>
</search>
<change>
Using this code i get the drop down. I have to change only one label name that is "not defined". But the value it passes should remain unchanged. It should only show "not defined" as "not categorized" in the dashboard only.
<panel depends="$UnlockAllCharts$">
<input type="dropdown" token="Tok_Unit" searchWhenChanged="true">
<label>Choose Software Unit</label>
<fieldForLabel>unit_label</fieldForLabel>
<fieldForValue>unit</fieldForValue>
<choice value="InitialValue">All</choice>
<default>InitialValue</default>
<initialValue>InitialValue</initialValue>
<showClearButton>false</showClearButton>
<search>
<query>index=abc source="*project.csv" | dedup unit| table unit | eval unit_label=if(unit="not defined","not categorized",unit)</query>
<earliest>0</earliest>
<latest></latest>
</search>
<change>
It worked properly.. Thank you so much for the help!!