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
Influencer

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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...