Dashboards & Visualizations

database value in dropdown

vikas_gopal
Builder

Hi All,
I am preparing a dashboard where in I want to place a dropdown and I want to pick the following query output in the dropdown
"select book_type_code from fa_deprn_periods where period_name='JAN-09'" .
I have done the following and it is showing nothing in the dropbox.





<![CDATA[| dbquery "select book_type_code from fa_deprn_periods where period_name='JAN-09'"]]>



Tags (1)
0 Karma
1 Solution

vikas_gopal
Builder

I found another solution for this . Using Lookup you can achieve the same.
follow the following steps
1) Create a csv file in the following location "Splunk homeetcappsdbxlookups lets say the file is "user.csv".Make sure u must have some data in the CSV file.Else if u chk my code I am creating a CSV from dbquery with the help of | outputlookup command.
2) Create a new lookup from Settings--->Lookups-->Lookup table file here select the same csv file which u have created u can choose the same file name in the destination lets say the name is "vikaslookup".
3) Make sure u chkd the permissions it should be global.
4) Now open splunk and type the following code and that is it.

| dbquery "your database" "select abcdate as "Fromdate" from help"| outputlookup user.csv




<![CDATA[ | inputlookup vikaslookup ]]>

2013

View solution in original post

0 Karma

vikas_gopal
Builder

I found another solution for this . Using Lookup you can achieve the same.
follow the following steps
1) Create a csv file in the following location "Splunk homeetcappsdbxlookups lets say the file is "user.csv".Make sure u must have some data in the CSV file.Else if u chk my code I am creating a CSV from dbquery with the help of | outputlookup command.
2) Create a new lookup from Settings--->Lookups-->Lookup table file here select the same csv file which u have created u can choose the same file name in the destination lets say the name is "vikaslookup".
3) Make sure u chkd the permissions it should be global.
4) Now open splunk and type the following code and that is it.

| dbquery "your database" "select abcdate as "Fromdate" from help"| outputlookup user.csv




<![CDATA[ | inputlookup vikaslookup ]]>

2013

0 Karma

somesoni2
Revered Legend

Just to be sure, check the field name returned by query when ran manually in search is matching fieldForValue and fieldForLabel values, including case

0 Karma

vikas_gopal
Builder

Linu

While pasting this code in the above section I manually delete the database name , but it is there in the actual code and sql query is returning results that I have checked .
I do not have much idea about Cdata and I am not sure if I can use dbquery in CSDATA...Please suggest

0 Karma

linu1988
Champion

You need to follow proper case when creating the view definition, Proper capitalization where ever needed. Have given the sample for you.

<form>
<fieldset>
<input type="dropdown" searchWhenChanged="true" token="drop">
<populatingSearch fieldForValue="book_type_code" fieldForLabel="book_type_code">
 <![CDATA[| dbquery database_name "select book_type_code from fa_deprn_periods where period_name='JAN-09'"]]>
 </populatingSearch>
 </input>
 </fieldset>
 </form>

Thanks

Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...