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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...