Getting Data In

Splunk DB Connect 1: Why am I unable to apply the date range from the time range picker to filter my query?

kavyaa
Explorer

Hi,

I have connected to Splunk database. I have applied "dropdown input" filter on "Transdate column". When I click on "2011-03-22", it is showing "2011-03-22" data. Filter is working fine. Token name as "field1" & query is as below.

| dbquery "srdb" "SELECT   TransDate as '_time', ShowRoomCode as srcode , Num_of_Customers as totalcs FROM  Centro_Customer_Visit where Centro_Customer_Visit.TransDate
='$field1$'"

But I want to apply time range picker on "TransDate" column dynamically. I have tried, but I didn't get the date range.

I have data from 2011 to 2015. I want to fetch data from March 2011 to April 2011 using time range picker. Is it possible? How it will work? Please help me and send any documentation on this.......

Thanks in advance,
A.kavya.

0 Karma

acharlieh
Influencer

Actually this exact problem seems to have been posted with a couple of solutions in a previous answer: https://answers.splunk.com/answers/75999/splunk-db-connect-dbquery-inline-search-and-time-filtering-...

kavyaa
Explorer

I have seen that post. I have tried . But i did nt get correct data regarding selected input time filter. The code is follows. Please help me. Timestamp column "TransDate" has no time , only date values

Trandate coulmn have data format like this

2011-03-18
2011-06-26
2012-03-16
2012-05-21
2013-04-23
2013-07-14
2014-02-12
2014-03-29
2015-01-21

xml code is as follow

**<form>
  <label>sample_time</label>
  <fieldset submitButton="false" autoRun="true">
    <input type="time" token="TOKEN1" searchWhenChanged="true">
      <label>Selct Date</label>
      <default>
        <earliest>1300645800</earliest>
        <latest>1300905000</latest>
      </default>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>| dbquery "CENTRO" "SELECT   TransDate , ShowRoomCode as srcode , Num_of_Customers as totalcs FROM  Centro_Customer_Visit  WHERE TransDate='$TOKEN1$'"</query>
          <earliest>1300645800</earliest>
          <latest>1332527400</latest>
        </search>
        <option name="wrap">true</option>
        <option name="rowNumbers">false</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="count">10</option>
      </table>
    </panel>
  </row>
</form>**
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...