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!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...