Dashboards & Visualizations

Change the one label name in the dynamic dropdown without affecting the actual value

anooshac
Communicator

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.

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
<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>

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

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.

0 Karma

anooshac
Communicator

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?

 

 

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

In your search query

| eval label=if(value="not defined","not categorized",value)
0 Karma

anooshac
Communicator

Thank you.. I tried this but in the dashboard the vale is showing as "not defined" only.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Can you share your dashboard XML?

0 Karma

anooshac
Communicator

<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.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
<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>
0 Karma

anooshac
Communicator

It worked properly.. Thank you so much for the help!!

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...