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
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...