Dashboards & Visualizations

Problem with token input radio options

zerocoolspain
Observer

Hi,

I have a problem with this panel.

Token $Y$ and $N$ lost values when change between radio input options (Yes/No).

The $trobots$ token show the literal value not the token value (Show literlally $N$ and $N$)





<input type="dropdown" token="tintervalo" searchWhenChanged="true">
<label>Intervalo</label>
<choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusoultimasemana">Última semana completa</choice>
<choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusoultimomes">Último mes completo</choice>
<choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusoultimotrimestre">Último trimestre completo</choice>
<choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusoultimoaño">Último año completo</choice>
<choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusomescurso">Mes en curso</choice>
<choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusoañoencurso">Año en curso</choice>
<choice value="7">Otros</choice>
<change>
<condition value="7">
<set token="show_timepicker">true</set>
<unset token="show_timepicker2"></unset>
if($ttime.earliest$=="",<set token="ttime.earliest">-4h@m</set>)
if($ttime.latest$=="",<set token="ttime.latest">now</set>)
if($trobots$=="",<set token="trobots">`filter_robots` `filter_robots_ip`</set>)
<set token="Y">| eval delete=delete</set>
<set token="N">`filter_robots` `filter_robots_ip`</set>
</condition>
<condition>
<unset token="show_timepicker"></unset>
<set token="show_timepicker2"></set>
if($trobots$=="",<set token="trobots">SinBots"</set>)
<set token="Y">conBots"</set>
<set token="N">sinBots"</set>
</condition>
<input type="radio" token="trobots" depends="$show_timepicker$" id="inputRadioRI" searchWhenChanged="true">
<label>Robots</label>
<choice value="$Y$">Yes</choice>
<choice value="$N$">No</choice>
<initialValue>$N$</initialValue>
</input>
Labels (1)
0 Karma

tscroggins
SplunkTrust
SplunkTrust

Hi @zerocoolspain,

I would use separate but similar radio inputs. Each radio input has its own set of tokens; however, updating a radio input also updates the global trobots token. The currently selected trobots1 and trobots2 values are preserved across changes to the tintervalo token.

<form version="1.1" theme="light">
<label>intervalo</label>
<init>
  <unset token="trobots"></unset>
</init>
<fieldset>
    <input type="dropdown" token="tintervalo" searchWhenChanged="true">
      <label>Intervalo</label>
      <choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusoultimasemana">Última semana completa</choice>
      <choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusoultimomes">Último mes completo</choice>
      <choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusoultimotrimestre">Último trimestre completo</choice>
      <choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusoultimoaño">Último año completo</choice>
      <choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusomescurso">Mes en curso</choice>
      <choice value="|loadjob savedsearch=&quot;q71139x:vap:precalculoVAPusoañoencurso">Año en curso</choice>
      <choice value="7">Otros</choice>
      <change>
        <condition match="'tintervalo'==7">
          <set token="show_trobots1">true</set>
          <unset token="show_trobots2"></unset>
          <set token="trobots">$trobots1$</set>
        </condition>
        <condition match="'tintervalo'!=7">
          <unset token="show_trobots1"></unset>
          <set token="show_trobots2"></set>
          <set token="trobots">$trobots2$</set>
        </condition>
      </change>
    </input>
    <input type="radio" token="trobots1" depends="$show_trobots1$" id="inputRadioRI1" searchWhenChanged="true">
      <label>Robots</label>
      <choice value="| eval delete=delete">Yes</choice>
      <choice value="`filter_robots` `filter_robots_ip`">No</choice>
      <initialValue>`filter_robots` `filter_robots_ip`</initialValue>
      <change>
        <set token="trobots">$trobots1$</set>
      </change>
    </input>
    <input type="radio" token="trobots2" depends="$show_trobots2$" id="inputRadioRI2" searchWhenChanged="true">
      <label>Robots</label>
      <choice value="conBots">Yes</choice>
      <choice value="sinBots">No</choice>
      <initialValue>sinBots</initialValue>
      <change>
        <set token="trobots">$trobots2$</set>
      </change>
    </input>
  </fieldset>
  <row>
    <html>
      <table>
        <tr>
          <td><b>tintervalo:</b></td><td>$tintervalo$</td>
        </tr>
        <tr>
          <td><b>trobots1:</b></td><td>$trobots1$</td>
        </tr>
        <tr>
          <td><b>trobots2:</b></td><td>$trobots2$</td>
        </tr>
        <tr>
          <td><b>trobots:</b></td><td>$trobots$</td>
        </tr>
      </table>
    </html>
  </row>
</form>

 

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...