Deployment Architecture

Run a different code for different values

jiaqya
Builder

i do have type=1 , type=2, and type=3

based on the type that is selected, i would like to run a different set of codes.
can you help me with syntax or provide direction.

Tags (1)
0 Karma

niketn
Legend

@jiaqya, try the following run anywhere dashboard which sets the query to run based on type selected in the dropdown through its <change> event handler.

<form>
  <label>Query based on Type</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="tokType" searchWhenChanged="true">
      <label>Select Type to run corresponding query</label>
      <choice value="type1">Type 1</choice>
      <choice value="type2">Type 2</choice>
      <choice value="type3">Type 3</choice>
      <selectFirstChoice>true</selectFirstChoice>
      <change>
        <condition value="type1">
          <set token="tokQuery">|  makeresults|  eval dummy="Search Query 1"</set>
        </condition>
        <condition value="type2">
          <set token="tokQuery">|  makeresults|  eval dummy="Search Query 2"</set>
        </condition>
        <condition value="type3">
          <set token="tokQuery">|  makeresults|  eval dummy="Search Query 3"</set>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>$tokQuery$</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">50</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">true</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
</form>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

jiaqya
Builder

Thanks Niket, ill try this and let you know.

0 Karma
Get Updates on the Splunk Community!

Unlock Instant Security Insights from Amazon S3 with Splunk Cloud — Try Federated ...

Availability: Must be on Splunk Cloud Platform version 10.1.2507.x to view the free trial banner. If you are ...

What's New in Splunk Observability - November 2025

What's New We’re excited to announce the latest enhancements to Splunk Observability Cloud and ...

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...