<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dashboard Studio - Search Result as Token in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-Search-Result-as-Token/m-p/741819#M58409</link>
    <description>&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.4.1/Viz/EventHandlerReference#chart_.28event_tokens.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.4.1/Viz/EventHandlerReference#chart_.28event_tokens.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I haven't done exactly what you are asking but I've done similar stuff.&amp;nbsp; The documents should help you out.&lt;/P&gt;</description>
    <pubDate>Fri, 14 Mar 2025 14:39:34 GMT</pubDate>
    <dc:creator>dural_yyz</dc:creator>
    <dc:date>2025-03-14T14:39:34Z</dc:date>
    <item>
      <title>Dashboard Studio - Search Result as Token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-Search-Result-as-Token/m-p/741597#M58393</link>
      <description>&lt;DIV class=""&gt;Hello,&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I am creating a dashboard with below searches to customize number of data points and time span displayed (using timechart) when different timerange is selected.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;STRONG&gt;Search 1 - Chart Span&lt;/STRONG&gt;: based on, custom timerange token, this returns span period and top values to be used in Search 3, given below.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval spantime=case($timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"@mon\") AND calldate&amp;lt;relative_time(now(),\"@d\")","1d",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"@d\") AND calldate&amp;lt;relative_time(now(),\"@m\")","1h",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-30d@d\") AND calldate&amp;lt;relative_time(now(),\"@d\")","1d",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-7d@d\") AND calldate&amp;lt;relative_time(now(),\"@d\")","1d",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-24h@h\") AND calldate&amp;lt;relative_time(now(),\"@h\")","1h",true(),"1d")
| eval startOfMonth=relative_time(now(),"@mon")
| eval noOfDays=round((now()-startOfMonth)/86400)
| eval startOfDay=relative_time(now(),"@d")
| eval noOfHours=round((now()-startOfDay)/3600-1)
| eval topvalues=case($timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"@mon\") AND calldate&amp;lt;relative_time(now(),\"@d\")",$noOfDays$,$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"@d\") AND calldate&amp;lt;relative_time(now(),\"@m\")","$noOfHours$",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-30d@d\") AND calldate&amp;lt;relative_time(now(),\"@d\")","30",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-7d@d\") AND calldate&amp;lt;relative_time(now(),\"@d\")","7",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-24h@h\") AND calldate&amp;lt;relative_time(now(),\"@h\")","24",true(),"1d")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;STRONG&gt;Search 2 - Saved Search:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;this is a report returning below fields:&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| table Date Duration "Handled by" Queue _time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;STRONG&gt;Search 3 - Chart:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;using &lt;STRONG&gt;Search 2&lt;/STRONG&gt; as base search and search result token values from&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Search 1&lt;/STRONG&gt;:&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=$Chart Span:result.spantime$ count as HourlyCalls
| sort $Chart Span:result.topvalues$ -_time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;now, when I load the dashboard, default timerange is&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;calldate&amp;gt;=relative_time(now(),\"-30d@d\") AND calldate&amp;lt;relative_time(now(),\"@d\")&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;, based on this I would expect&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Search 3&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;as,&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=1d count as HourlyCalls
| sort 30 -_time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;but it shows below error message:&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Set token value to render visualization
$noOfDays$
$noOfHours$
$spantime$
$topvalues$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;can someone please suggest what is wrong here and how can I fix this?&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Thank you.&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Mar 2025 14:34:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-Search-Result-as-Token/m-p/741597#M58393</guid>
      <dc:creator>madhav_dholakia</dc:creator>
      <dc:date>2025-03-12T14:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Studio - Search Result as Token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-Search-Result-as-Token/m-p/741819#M58409</link>
      <description>&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.4.1/Viz/EventHandlerReference#chart_.28event_tokens.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.4.1/Viz/EventHandlerReference#chart_.28event_tokens.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I haven't done exactly what you are asking but I've done similar stuff.&amp;nbsp; The documents should help you out.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 14:39:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-Search-Result-as-Token/m-p/741819#M58409</guid>
      <dc:creator>dural_yyz</dc:creator>
      <dc:date>2025-03-14T14:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Studio - Search Result as Token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-Search-Result-as-Token/m-p/742075#M58441</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/194981"&gt;@dural_yyz&lt;/a&gt;&amp;nbsp;- this is for Simple XML Dashboards if I understood correctly? I am using dashboard studio.&lt;/P&gt;&lt;P&gt;I got this fixed, thanks to &lt;A href="https://splunkcommunity.slack.com/archives/C2RC5Q17E/p1741907546354059?thread_ts=1741762871.350709&amp;amp;cid=C2RC5Q17E" target="_blank" rel="noopener"&gt;this&lt;/A&gt; response on Slack Splunk Community.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Fix:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Search 1 refers to all of those tokens in the final eval but you haven’t defined them. Are you meaning to use the fields you’ve defined in the previous eval statements? If so, you &lt;EM&gt;just need to remove the $$ from around the field names in that final eval in search 1&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;updated Search 1:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval spantime=case($timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"@mon\") AND calldate&amp;lt;relative_time(now(),\"@d\")","1d",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"@d\") AND calldate&amp;lt;relative_time(now(),\"@m\")","1h",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-30d@d\") AND calldate&amp;lt;relative_time(now(),\"@d\")","1d",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-7d@d\") AND calldate&amp;lt;relative_time(now(),\"@d\")","1d",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-24h@h\") AND calldate&amp;lt;relative_time(now(),\"@h\")","1h",true(),"1d")
| eval startOfMonth=relative_time(now(),"@mon")
| eval noOfDays=round((now()-startOfMonth)/86400)
| eval startOfDay=relative_time(now(),"@d")
| eval noOfHours=round((now()-startOfDay)/3600-1)
| eval topvalues=case($timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"@mon\") AND calldate&amp;lt;relative_time(now(),\"@d\")",noOfDays,$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"@d\") AND calldate&amp;lt;relative_time(now(),\"@m\")",$noOfHours$,$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-30d@d\") AND calldate&amp;lt;relative_time(now(),\"@d\")","30",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-7d@d\") AND calldate&amp;lt;relative_time(now(),\"@d\")","7",$timerange|s$="| where calldate&amp;gt;=relative_time(now(),\"-24h@h\") AND calldate&amp;lt;relative_time(now(),\"@h\")","24",true(),"1d")&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 10:00:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-Search-Result-as-Token/m-p/742075#M58441</guid>
      <dc:creator>madhav_dholakia</dc:creator>
      <dc:date>2025-03-18T10:00:46Z</dc:date>
    </item>
  </channel>
</rss>

