Dashboards & Visualizations

Append dropdown to text box

mwdbhyat
Builder

Hi there,

I have a dashboard with 3 dropdown inputs and a text box. I am trying to get whatever i select from the 3 dropdown boxes to appear in the adjacent text box, essentially just appending the tokens to the whitespace and only running when they appear in that box and i hit "submit". The selections from the dropdown need to be in " ". I also want it to then clear previous selections if i go back and change one of the dropdowns again.

Has anyone got any thoughts on how i could achieve this?

Currently this almost works - i just need to figure out the append part properly:

<fieldset submitButton="false">
<input type="dropdown" token="mainSection">
  <label>Main Section</label>
  <fieldForLabel>MainSection</fieldForLabel>
  <fieldForValue>MainSection</fieldForValue>
  <search>
    <query>| inputlookup bla.csv
| fillnull value="(empty)"
| fields MainSection
| dedup 1 MainSection</query>
    <earliest>-24h@h</earliest>
    <latest>now</latest>
  </search>
</input>
<input type="dropdown" token="subSection">
  <label>SubSection</label>
  <fieldForLabel>SubSection</fieldForLabel>
  <fieldForValue>SubSection</fieldForValue>
  <search>
    <query>| inputlookup bla.csv
| fillnull value="(empty)"
| search MainSection="$mainSection$"
| fields SubSection
| dedup 1 SubSection</query>
    <earliest>-24h@h</earliest>
    <latest>now</latest>
  </search>
</input>
<input type="dropdown" token="dataLine">
  <label>DatalineName</label>
  <fieldForLabel>DatalineName</fieldForLabel>
  <fieldForValue>Dataline</fieldForValue>
  <search>
    <query>| inputlookup bla.csv
| fillnull value="(empty)"
| search MainSection="$mainSection$"
| search SubSection="$subSection$"
| fields DatalineName Dataline
| dedup 1 DatalineName</query>
    <earliest>-24h@h</earliest>
    <latest>now</latest>
  </search>
  <change>
    <eval token="chosen_dls">$chosen_dls$." ".$dataLine$</eval>
  </change>
</input>
<input type="text" token="chosen_dls">
  <label>selected</label>
</input>

Thanks!

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @mwdbhyat,
When you speak of thext box, a Single Value coulkd be useful for you?
If yes, see this example with two dropdowns and the choosed values displayed in a Single Value box, then you can use the tokens also for your searches.

<form>
  <label>Search Box</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="token1">
      <label>token 1</label>
      <choice value="One">One</choice>
      <choice value="Two">Two</choice>
    </input>
    <input type="dropdown" token="token2">
      <label>token 2</label>
      <choice value="Three">Three</choice>
      <choice value="Four">Four</choice>
    </input>
  </fieldset>
  <row>
    <panel>
      <single>
        <search>
          <query>| makeresults | eval search_box="$token1$ $token2$" | table search_box</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="drilldown">none</option>
      </single>
    </panel>
  </row>
</form>

Ciao.
Giuseppe

0 Karma

mwdbhyat
Builder

Unfortunately it needs to be exactly as i described it above.. i suspect there may be a need for some JS to make this work the way I want it to!

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @mwdbhyat,
You could modify CSS and put an HTML box in the input section to use to display the tokens, but I cannot help to do this!

Ciao.
Giuseppe

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...