Dashboards & Visualizations

Using a token in a search

dbcase
Motivator

Hi I have this XML code

<input type="dropdown" token="mso_selection">
      <label>Select a MSO</label>
      <search>
        <query>index=wholesale_app  sourcetype=wholesale_mobile_app | spath buildTarget  | dedup buildTarget</query>
        <earliest>-1d</earliest>
        <latest>now</latest>
      </search>
      <fieldForLabel>buildTarget</fieldForLabel>
      <fieldForValue>buildTarget</fieldForValue>
    </input>

 <input type="radio" token="Product_token">
        <label>Select a Product</label>
       <choice value="All">All</choice>
       <choice value="Converge">Converge</choice>
       <choice value="Touchstone">Touchstone</choice>
       <default>All</default>
       <change>
         <condition value="All">
           <set token="productsearchquery">[search index=wholesale_app buildTarget=$mso_selection$ analyticType=Checkpoint     Properties.index=39 OR Properties.index=40|dedup clientSessionId|table clientSessionId]</set>
           <unset token="productsearchquery"></unset>
         </condition>
         <condition value="Converge">
           <set token="productsearchquery">[search index=wholesale_app buildTarget=$mso_selection$ analyticType=Checkpoint     Properties.index=39|dedup clientSessionId|table clientSessionId]</set>
          <unset token="productsearchquery"></unset>
          </condition>
          <condition value="Touchstone">
           <set token="productsearchquery">[search index=wholesale_app buildTarget=$mso_selection$ analyticType=Checkpoint     Properties.index=40|dedup clientSessionId|table clientSessionId]</set>
          <unset token="productsearchquery"></unset>
          </condition>


       </change>
     </input>

And then I have this query

<query>index=wholesale_app buildTarget=$mso_selection$ analyticType=SessionStart $productsearchquery$   |lookup phone_models_edited.csv Model AS Properties.platformData.HM
 | stats count  by   Display_model | rename  Display_model as "Phone Model" count as Count|sort -Count</query>

And the panel on the dashboard sits there saying waiting for input even after everything is selected. Where am I going wrong?

Tags (2)
0 Karma
1 Solution

dbcase
Motivator
0 Karma

dbcase
Motivator

Found it......

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Is it the issue due to <unset token="productsearchquery"></unset> ?

0 Karma

micahkemp
Champion

Do you mind posting the solution you found?

0 Karma

nkkn87
New Member

Yes, I would like to know the answer too.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

HI @dbcase,

You are setting productsearchquery in all three condition and very next unsetting the same token. Is it right?

<condition value="All">
            <set token="productsearchquery">[search index=wholesale_app buildTarget=$mso_selection$ analyticType=Checkpoint     Properties.index=39 OR Properties.index=40|dedup clientSessionId|table clientSessionId]</set>
            <unset token="productsearchquery"></unset>
          </condition>
          <condition value="Converge">
            <set token="productsearchquery">[search index=wholesale_app buildTarget=$mso_selection$ analyticType=Checkpoint     Properties.index=39|dedup clientSessionId|table clientSessionId]</set>
           <unset token="productsearchquery"></unset>
           </condition>
           <condition value="Touchstone">
            <set token="productsearchquery">[search index=wholesale_app buildTarget=$mso_selection$ analyticType=Checkpoint     Properties.index=40|dedup clientSessionId|table clientSessionId]</set>
           <unset token="productsearchquery"></unset>
           </condition>

Bcoz, same token productsearchquery you are using in search query.

<query>index=wholesale_app buildTarget=$mso_selection$ analyticType=SessionStart $productsearchquery$    |lookup phone_models_edited.csv Model AS Properties.platformData.HM
  | stats count  by   Display_model | rename  Display_model as "Phone Model" count as Count|sort -Count</query>

Thanks

0 Karma

dbcase
Motivator

a bit more information.... if I remove $productsearchquery$ the panel works. So the problem is setting that token somehow but I can't seem to figure out why its not being set....

0 Karma

micahkemp
Champion

What is the point of <unset token="productsearchquery"></unset> after each <set>?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...