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!

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 ...