Dashboards & Visualizations

How to get multiple tokens from a single dropdown input on a form?

johnglass
Explorer

I've got a CSV file with four columns, something similar to below:

dc_index,dc_name,dc_snow,dc_int,dc_int_speed
dc_anchorage,Anchorage,APG ANC *,41544000
dc_albany,Albany,APG ALB *,31544000
dc_albuquerque,Albuquerque,APG ALQ *,153072000
dc_altoona,Altoona,APG ALT *,31544000
dc_atlanta,Atlanta,APG ATL *,103072000
dc_billings,Billings,APG BIL *,111536000

I'm looking for a way to capture the values of all columns when a single row is selected. For example, say on the form I have a dropdown for "dc_name". When Anchorage is selected, I need it as well as the other three columns to be captured in tokens and passed on to charts within the form.

I've got it working with multiple dropdowns on the form. When you choose the first option it does an inputlookup and the other inputs are populated with the values of the row, however I don't want 4 separate dropdowns on the form. Is there a way to accomplish this? This is what I have today, but my preference would be to have just two dropdowns; a time picker and DC Name.

<form>
  <label>DC View</label>
  <fieldset submitButton="false" autoRun="true">
    <input type="time" searchWhenChanged="true">
      <label>Choose time range:</label>
      <default>
        <earliestTime>-24h@h</earliestTime>
        <latestTime>now</latestTime>
      </default>
    </input>
    <input type="dropdown" searchWhenChanged="true" token="dc_index">
      <label>Choose DC:</label>
      <selectFirstChoice>false</selectFirstChoice>
      <populatingSearch earliest="$earliest$" latest="$latest$" fieldForLabel="dc_name" fieldForValue="dc_index">
        <![CDATA[ | inputlookup dc_info.csv | table dc_index dc_name]]>
      </populatingSearch>
      <change>
        <unset token="form.dc_snow"></unset>
        <unset token="dc_snow"></unset>
      </change>
    </input>
    <input type="dropdown" searchWhenChanged="true" token="dc_snow">
      <label>DC SNOW ID:</label>
      <selectFirstChoice>true</selectFirstChoice>
      <populatingSearch earliest="0" latest="now" fieldForLabel="dc_snow" fieldForValue="dc_snow">
        <![CDATA[ | inputlookup dc_info.csv | search dc_index="$dc_index$" | table dc_snow]]>
      </populatingSearch>
    </input>
  </fieldset>
Tags (3)

HiroshiSatoh
Champion

Although not tried・・・
For example, What about with this?

<populatingSearch earliest="$earliest$" latest="$latest$" fieldForLabel="dc_name" fieldForValue="dc_index">
         <![CDATA[ | inputlookup dc_info.csv | table dc_index dc_name]]>

<populatingSearch earliest="$earliest$" latest="$latest$" fieldForLabel="dc_name" fieldForValue="swhere">
         <![CDATA[ | inputlookup dc_info.csv | eval swhere="dc_index="+dc_index+" dc_snow="+dc_snow]]>
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...