All Apps and Add-ons

How do I default 'select all' in a db connect query with a multi-select on a dashboard?

thomasneat
Engager

The dashboard panel works great except that due to the multi-select and the options in the query the initial page is waiting for input from the multi-select box and I cannot get the wildcard * to select all.

I would like to make the multi-select default 'all' but cannot get it to work. 'No results found.'

Edit: Posting code works a little different here than other sites.

  <label>Date Range</label>
  <default>
    <earliest>-2d@d</earliest>
    <latest>now</latest>
  </default>
  <change>
    <eval token="form.et">strftime(relative_time(now(),'earliest'), "%F %T")</eval>
    <eval token="form.lt">strftime(relative_time(now(),'latest'), "%F %T")</eval>
  </change>
</input>
<input type="multiselect" token="code" searchWhenChanged="true">
  <label>Code</label>
  <choice value="">All</choice>
  <choice value="1">1</choice>
  <choice value="2">2</choice>
  <choice value="3">3</choice>
  <delimiter> OR </delimiter>
  <valuePrefix>Code = '</valuePrefix>
  <valueSuffix>'</valueSuffix>
</input>

<query>| dbxquery query="SELECT Date,ID,City,Amount,Code FROM \"Safe\".\"dbo\".\"Data\" WHERE ($code$) AND (Date &gt;= '$form.et$' AND Date &lt;= '$form.lt$')" connection="database" | sort num(City)</query>
0 Karma

thomasneat
Engager

I wish I was. I've tried it with the wildcard * and with a carrot ^ I gathered from other responses. Nothing supplies any results. If I leave out the multiselect altogether it gives me everything within the date ranges.

0 Karma

nickhills
Ultra Champion
  <label>Date Range</label>
   <default>
     <earliest>-2d@d</earliest>
     <latest>now</latest>
   </default>
   <change>
     <eval token="form.et">strftime(relative_time(now(),'earliest'), "%F %T")</eval>
     <eval token="form.lt">strftime(relative_time(now(),'latest'), "%F %T")</eval>
   </change>
 </input>
 <input type="multiselect" token="code" searchWhenChanged="true">
   <label>Code</label>
   <choice value="*">All</choice>
   <choice value="1">1</choice>
   <choice value="2">2</choice>
   <choice value="3">3</choice>
   <delimiter> OR </delimiter>
   <valuePrefix>Code = '</valuePrefix>
   <valueSuffix>'</valueSuffix>
 </input>
 <query>| dbxquery query="SELECT Date,ID,City,Amount,Code FROM \"Safe\".\"dbo\".\"Data\" WHERE ($code$) AND (Date >= '$form.et$' AND Date <= '$form.lt$')" connection="database" | sort num(City)</query>

Are you just missing * from the ALL option?

If my comment helps, please give it a thumbs up!
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...