Dashboards & Visualizations

How can I check to see if a token is unset before setting it; essentially using the same link to set/unset a token?

toutla
Explorer

I am trying to use the same drilldown link to toggle the function of setting and unsetting the same token.  

 

Current Code

<drilldown>
   <condition>
      <set token="arrangements_details">true</set>
    </condition>
</drilldown>

 

The idea - just need correct syntax

<drilldown>
   <condition match="$arrangements_details$=null">
      <set token="arrangements_details">true</set>
    </condition>

   <condition match="$arrangements_details$=true">
      <unset token="arrangements_details">true</unset>
    </condition>
</drilldown>

 

Any suggestions?

0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

I'm guessing this is about using dependent panels. There are a couple of problems in your match statement

1. Using = null - use isnull()

2. = true must be quoted with &quot;

See this

<dashboard>
  <label>Click Toggle</label>
  <row>
    <panel>
      <table>
        <search>
          <query>
            index=_internal earliest=-5s
            | stats count by _time
          </query>
        </search>
        <drilldown>
          <condition match="isnull($arrangements_details$)">
            <set token="arrangements_details">true</set>
          </condition>
          <condition match="$arrangements_details$=&quot;true&quot;">
            <unset token="arrangements_details">true</unset>
          </condition>
        </drilldown>
      </table>
    </panel>
    <panel depends="$arrangements_details$">
      <table>
        <title>arrangements_details=$arrangements_details$</title>
        <search>
          <query>
            | makeresults
            | eval Drilldown="Clicked"
            | table Drilldown
          </query>
        </search>
      </table>
    </panel>
  </row>
</dashboard>

Hope this helps

 

View solution in original post

0 Karma

bowesmana
SplunkTrust
SplunkTrust

I'm guessing this is about using dependent panels. There are a couple of problems in your match statement

1. Using = null - use isnull()

2. = true must be quoted with &quot;

See this

<dashboard>
  <label>Click Toggle</label>
  <row>
    <panel>
      <table>
        <search>
          <query>
            index=_internal earliest=-5s
            | stats count by _time
          </query>
        </search>
        <drilldown>
          <condition match="isnull($arrangements_details$)">
            <set token="arrangements_details">true</set>
          </condition>
          <condition match="$arrangements_details$=&quot;true&quot;">
            <unset token="arrangements_details">true</unset>
          </condition>
        </drilldown>
      </table>
    </panel>
    <panel depends="$arrangements_details$">
      <table>
        <title>arrangements_details=$arrangements_details$</title>
        <search>
          <query>
            | makeresults
            | eval Drilldown="Clicked"
            | table Drilldown
          </query>
        </search>
      </table>
    </panel>
  </row>
</dashboard>

Hope this helps

 

0 Karma

toutla
Explorer

That worked perfectly, thank you!!!

0 Karma
Get Updates on the Splunk Community!

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...