Dashboards & Visualizations

Make Null while changed

Raging_Rags
Engager
<form theme="dark">
  <label>U Clone</label>
  <fieldset submitButton="true">
    <input type="radio" token="field1">
      <label>Select Parameter (Ensure all are null and no spaces)</label>
      <choice value="Email ID">Email</choice>
      <choice value="usrid">External User ID</choice>
      <choice value="wid">W ID</choice>
      <change>
        <condition value="Email ID">
          <set token="inputemail"></set>
          <unset token="tknusr_id">NULL</unset>
          <unset token="tknwid">NULL</unset>
        </condition>
        <condition value="usrid">
          <unset token="inputemail">NULL</unset>
          <set token="tknusr_id"></set>
          <unset token="tknwid">NULL</unset>
        </condition>
        <condition value="wid">
          <unset token="inputemail">NULL</unset>
          <unset token="tknusr_id">NULL</unset>
          <set token="tknwid"></set>
        </condition>
        <condition>
          <unset token="inputemail">NULL</unset>
          <unset token="tknusr_id">NULL</unset>
          <unset token="tknwid">NULL</unset>
        </condition>
      </change>
      <initialValue>Email ID</initialValue>
    </input>
    <input type="text" token="dn" depends="$inputemail$" searchWhenChanged="false">
      <label>Email ID</label>
      <default>NULL</default>
    </input>
    <input type="text" token="usrid" depends="$tknusr_id$" searchWhenChanged="false">
      <label>External User ID</label>
      <default>NULL</default>
    </input>
    <input type="text" token="wid" depends="$tknwid$" searchWhenChanged="false">
      <label>W ID</label>
      <default>NULL</default>

Above is my code for inputs. A dynamic radio button setup. I want to make the values which are not selected. If the user enters a value and makes a search with it and when he wants to search with a different value, the other two should become null.

 

Eg; Primarily Users searches email_id and then searches with wi, the email_id should become null. only the results for respective wid should be displayed.

 

Thanks in Advance!

0 Karma

htrednek
Explorer

To set a null token don't use UNSET.  Your searches will not run and will say they're waiting for input because they'll still have $tokenname$ sitting there.  Set an empty token instead.  <set token="xyz"></set>

Example: When you unset a menu, also set it's token value.

<form theme="dark">
  <label>U Clone</label>
  <fieldset submitButton="true">
    <input type="radio" token="field1">
      <label>Select Parameter (Ensure all are null and no spaces)</label>
      <choice value="Email ID">Email</choice>
      <choice value="usrid">External User ID</choice>
      <choice value="wid">W ID</choice>
      <change>
        <condition value="Email ID">
          <set token="inputemail"></set>
          <unset token="tknusr_id"></unset>
          <set token="usrid"></set>
          <unset token="tknwid"></unset>
          <set token="wid"></set>
        </condition>
        <condition value="usrid">
          <unset token="inputemail"></unset>
          <set token="dn"></set>
          <set token="tknusr_id"></set>
          <unset token="tknwid"></unset>
          <set token="wid"></set>
        </condition>
        <condition value="wid">
          <unset token="inputemail"></unset>
          <set token="dn"></set>
          <unset token="tknusr_id"></unset>
          <set token="usrid"></set>
          <set token="tknwid"></set>
        </condition>
        <condition>
          <unset token="inputemail">NULL</unset>
          <unset token="tknusr_id">NULL</unset>
          <unset token="tknwid">NULL</unset>
        </condition>
      </change>
      <initialValue>Email ID</initialValue>
    </input>
    <input type="text" token="dn" depends="$inputemail$" searchWhenChanged="false">
      <label>Email ID</label>
      <default>NULL</default>
    </input>
    <input type="text" token="usrid" depends="$tknusr_id$" searchWhenChanged="false">
      <label>External User ID</label>
      <default>NULL</default>
    </input>
    <input type="text" token="wid" depends="$tknwid$" searchWhenChanged="false">
      <label>W ID</label>
      <default>NULL</default>

   

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Not sure if it will help, but the set directive should have an argument whereas unset should have no argument.

        <condition value="usrid">
          <unset token="inputemail"></unset>
          <set token="tknusr_id">true</set>
          <unset token="tknwid"></unset>
        </condition>

 

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...