Dashboards & Visualizations

how to display token value based on condition in the title

k_harini
Communicator

I have a condition where i should display token value in title. If value is *, nothing needs to be displayed. Anything else then that value needs to be displayed from drop down.

`

          <set token="my_test">$IG_tok$</set>

        </condition>


        <condition match="'IG_tok'==&quot;*&quot;">
          <set token="my_test"> </set>

        </condition> 
</change>`

I tried the above. but here if IG_tok is any value other than * - it takes previous value of IG_tok and not current one that we select,
I also tried this
<eval token="my_test">if($IG_tok$="*"," ",$IG_tok$)</eval>

DId not work. Takes previous value here as well. how to do this? please help in resolving this issue

Tags (1)
0 Karma

k_harini
Communicator

Title should be displayed with ig_tok value. There are around 10 unique values. By default we have * .. when All is selected,(' *') would appear in title. Requirement is - Star alone should not be displayed. Anything else should be displayed. I tried with 2 panels to see if i can remove star from title. It dint work.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi
Can you please share dashboard XML?

0 Karma

k_harini
Communicator

Basically the ask is this - if we have * then in title it should not display anything and if the token has any other value other than * it should display the value. Please find the code here
`
PDF

<panel depends="$show_panel$">
  <html>
    <div class="left_logo">
      <div class="right_logo">
        <h2 align="center">
          <b>
        A&amp;PD Dashboard $my_test$ 
             </b>
        </h2>
      </div>
    </div> 
  </html>
</panel>
 <panel rejects="$show_panel$">
  <html>
    <div class="left_logo">
      <div class="right_logo">
        <h2 align="center">
          <b>
        A&amp;PD Dashboard $IG_tok$ 
             </b>
        </h2>
      </div>
    </div> 
  </html>
</panel>


<panel>
  <input type="dropdown" token="IG_tok" searchWhenChanged="true">
    <label>IG</label>
    <choice value="*">All</choice>
    <default>*</default>
    <fieldForLabel>IG</fieldForLabel>
    <fieldForValue>IG</fieldForValue>
    <search>
      <query>index=aof_* |dedup IG|table IG</query>
    </search>
    <change>
      <condition match="'IG_tok'==&quot;*&quot;">
          <set token="my_test"> </set>
         <set token="show_panel">true</set>
        </condition> 
       <condition match="'IG_tok'!=&quot;*&quot;"> 
          <unset token="show_panel">false</unset>
        </condition>
     </change>
   </input>
</panel> `

Please help. This looks simple. but I spent good amount of time here. unable to resolve. Any help is highly appreciated

0 Karma

niketn
Legend

@k_harini, as per your code, since you are keeping separate panels for whether All is selected in Dropdown or not.

Since the Panel to be displayed for All condition will only be displayed when All ( * ) is selected from dropdown, why do you need to use token to display panel title? You can just have Static title.

Only if there was only one panel with Panel Title to be changed when All is selected or when anything else is selected, would have made more sense. If I have misunderstood your use case or your code, please explain the same.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

October 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Splunk Education Goes to Washington | Splunk GovSummit 2024

If you’re in the Washington, D.C. area, this is your opportunity to take your career and Splunk skills to the ...