Dashboards & Visualizations

How to refresh highlighted value choice in an link type input ?

support0
Path Finder

Hello there,

I have a panel with two choices :

<panel>
  <input type="link">
    <choice value="link1">Down</choice>
    <choice value="link2">Up</choice>
    <default>Down</default>
    <change>
      <condition value="link1">
        <set token="pools_down">true</set>
        <unset token="pools_up"></unset>
      </condition>
      <condition value="link2">
        <unset token="pools_down"></unset>
        <set token="pools_up">true</set>
      </condition>
    </change>
  </input>
  <table depends="$pools_down$">
    <search>
      <query>foo</query>
    </search>
  </table>
  <table depends="$pools_up$">
    <search >
      <query>bar</query>
    </search>
  </table>
</panel>

It works fine:

alt text

alt text

I am trying to drilldown from a single value panel using pools_down or pools_up tokens.

It also works :

<panel>
  <single>
    <search>
      <query>foo</query>
    </search>
    <drilldown>
      <set token="pools_up">true</set>
      <unset token="pools_down"></unset>
    </drilldown>
  </single>
</panel>

However, the highlighted choice value is not being refreshed in the process:

alt text

Not a big deal I agree but I am still trying to figure out how the highlighted choice could be somehow refreshed.

I have tried using an additional token but without success so far.

Any hint ?

Thanks in advance

0 Karma
1 Solution

jrballesteros05
Communicator

Hello, you should change the tokens "pools_down" for "form.pools_down". I did a lab and it worked for me. The code is a bit different from yours and quite dirty but I think it is going to help you.

<form>
  <label>Prueba</label>
  <fieldset submitButton="false"></fieldset>
  <row>
    <panel>
      <single>
        <search>
          <query>bar|stats count</query>
        </search>
        <drilldown>
          <eval token="form.linkinput">"link2"</eval>
          <unset token="form.pools_down"></unset>
        </drilldown>
      </single>
    </panel>
  </row>
  <row>
    <panel>
      <input type="link" token="linkinput">
        <label>$linkinput$</label>
        <choice value="link1">Down</choice>
        <choice value="link2">Up</choice>
        <default>link1</default>
        <change>
          <condition value="link1">
            <set token="form.pools_down">index=_internal | stats count</set>
            <unset token="form.pools_up"></unset>
          </condition>
          <condition value="link2">
            <set token="form.pools_up">bar | stats count</set>
            <unset token="form.pools_down"></unset>
          </condition>
        </change>
      </input>
      <table depends="$form.pools_down$">
        <search>
          <query>$form.pools_down$</query>
        </search>
      </table>
      <table depends="$form.pools_up$">
        <search>
          <query>$form.pools_up$</query>
        </search>
      </table>
    </panel>
  </row>
</form>

View solution in original post

jrballesteros05
Communicator

Hello, you should change the tokens "pools_down" for "form.pools_down". I did a lab and it worked for me. The code is a bit different from yours and quite dirty but I think it is going to help you.

<form>
  <label>Prueba</label>
  <fieldset submitButton="false"></fieldset>
  <row>
    <panel>
      <single>
        <search>
          <query>bar|stats count</query>
        </search>
        <drilldown>
          <eval token="form.linkinput">"link2"</eval>
          <unset token="form.pools_down"></unset>
        </drilldown>
      </single>
    </panel>
  </row>
  <row>
    <panel>
      <input type="link" token="linkinput">
        <label>$linkinput$</label>
        <choice value="link1">Down</choice>
        <choice value="link2">Up</choice>
        <default>link1</default>
        <change>
          <condition value="link1">
            <set token="form.pools_down">index=_internal | stats count</set>
            <unset token="form.pools_up"></unset>
          </condition>
          <condition value="link2">
            <set token="form.pools_up">bar | stats count</set>
            <unset token="form.pools_down"></unset>
          </condition>
        </change>
      </input>
      <table depends="$form.pools_down$">
        <search>
          <query>$form.pools_down$</query>
        </search>
      </table>
      <table depends="$form.pools_up$">
        <search>
          <query>$form.pools_up$</query>
        </search>
      </table>
    </panel>
  </row>
</form>

support0
Path Finder

It does work this way ! Thanks a lot !

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...