Archive

how to display token value based on condition in the title

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

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

SplunkTrust
SplunkTrust

Hi
Can you please share dashboard XML?

0 Karma

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

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
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!