Dashboards & Visualizations

Using url form parameters in section of dashboard to create tokens for panel depends

Influencer

I have a dashboard that has a 2 box checkbox and depending on the options set in that checkbox, I show or hide an input panel for the selected option.

So, my checkbox is managed like this

    <input type="checkbox" token="show_filters">
      <label></label>
      <choice value="a">Show Enrichment filters</choice>
      <choice value="b">Show Splunk filters</choice>
      <delimiter> </delimiter>
      <change>
        <condition match="$show_filters$ = &quot;a&quot;">
          <set token="enrich">1</set>
          <unset token="splunk"></unset>
        </condition>
        <condition match="$show_filters$ = &quot;a b&quot;">
          <set token="enrich">1</set>
          <set token="splunk">1</set>
        </condition>
        <condition match="$show_filters$ = &quot;b&quot;">
          <unset token="enrich"></unset>
          <set token="splunk">1</set>
        </condition>
        <condition match="isnull($show_filters$)">
          <unset token="enrich"></unset>
          <unset token="splunk"></unset>
        </condition>
      </change>
    </input>

then I have two input panels protected like

    <panel depends="$enrich$">
      <input...>
      </input>
    </panel>
    <panel depends="$splunk$">
      <input...>
      </input>
    </panel>

and that all works fine in the dashboard. However, when I try to pass in the relevant options from a URL I can get the checkbox parameters set correctly by passing in form.show_filters=a, but form.enrich=1 does not cause the dependent enrich panel to be shown and if I add the $enrich$ token to a panel title, it is not set.

So, I tried to make an section of the dashboard to do this with each of the 3 pairs below in turn, but none seem to work.

  <init>
    <eval token="enrich">if(match($form.show_filters$,"a"),1,)</eval>
    <eval token="splunk">if(match($form.show_filters$,"b"),1,)</eval>

    <eval token="enrich">if(match($show_filters$,"a"),1,)</eval>
    <eval token="splunk">if(match($show_filters$,"b"),1,)</eval>

    <eval token="enrich">$form.enrich$</eval>
    <eval token="splunk">$form.splunk$</eval>
  </init>

I also tried adding a base search with a finalized section to do conditional matching and token setting to no avail.

Does anyone know if this is possible?

0 Karma

Path Finder

I think this is similar to issues I have experienced in the past. Try adding a default value for your show_filters input. Your trigger points are based on a change in value, however you arent actually changing the value when you load the dashboard with a prefilled value as the dashboard will treat that as the initial value (and as such, you arent changing it).

0 Karma

Influencer

I've tried so many variants of that, but it just seems that the tokens are not evaluated correctly. I've tried about a million variants now 😞

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!