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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...