<?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: If else condition for dashboard in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-else-condition-for-dashboard/m-p/340743#M22145</link>
    <description>&lt;P&gt;something like this might get you started (you will need two panels, though, but only one will show based on the input):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="type" token="token"&amp;gt;
      &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
      &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
OTHER CHOICES
       &amp;lt;change&amp;gt;
         &amp;lt;condition&amp;gt;
            &amp;lt;set token="pan2"&amp;gt;&amp;amp;#32;&amp;lt;/set&amp;gt;
            &amp;lt;unset token="pan1"&amp;gt;&amp;lt;/unset&amp;gt;&amp;lt;/condition&amp;gt;
        &amp;lt;condition value="*"&amp;gt;
            &amp;lt;set token="pan1"&amp;gt;&amp;amp;#32;&amp;lt;/set&amp;gt;
            &amp;lt;unset token="pan2"&amp;gt;&amp;lt;/unset&amp;gt;
          &amp;lt;/condition&amp;gt;
        &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then use $pan1$ and $pan2$ in the searches: index=monthlycdr $result0sec$ $result$ $pan1$&lt;/P&gt;

&lt;P&gt;and use &lt;CODE&gt;&amp;lt;panel depends=$pan1$&amp;gt;&lt;/CODE&gt; in the panel that has that token in it, etc. you might need to edit it a bit. &lt;BR /&gt;
&lt;A href="https://www.splunk.com/blog/2017/06/29/load-em-up-and-move-em-out-controlling-dashboard-panel-load-order.html"&gt;https://www.splunk.com/blog/2017/06/29/load-em-up-and-move-em-out-controlling-dashboard-panel-load-order.html&lt;/A&gt;&lt;BR /&gt;
this is a blog post for help on it.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2017 21:33:03 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2017-12-14T21:33:03Z</dc:date>
    <item>
      <title>If else condition for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-else-condition-for-dashboard/m-p/340741#M22143</link>
      <description>&lt;P&gt;How can I do an if token=something then run this query for the panel and else to run another query for that same panel?&lt;BR /&gt;
So I have the following query:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;query 1:&lt;/STRONG&gt;&lt;BR /&gt;
index="monthlycdr" $result0sec$ $result$ |  eval "Call Duration"=replace('Call Duration',"\"","") | convert dur2sec("Call Duration") as "CDinsec" |  eval "Name"=replace('Name',"\"","")  | eval "Name" = substr(Name,1,3) &lt;BR /&gt;
| eval "Name" = upper(Name)&lt;BR /&gt;
| rex field=Name mode=sed "s/AAA/APAC/g"&lt;BR /&gt;
| rex field=Name mode=sed "s/ABC/ABCD3/g"&lt;BR /&gt;
| rex field=Name mode=sed "s/CDF/CDF123/g"&lt;BR /&gt;
| eval "transporttype"=replace('Transport Type',"\"","")  | eval "Voice_count"=case( match(transporttype, "(?i)voice") OR match(transporttype, "(?i)pstn"), CDinsec) &lt;BR /&gt;
|  eval "Video_count" =case(match(transporttype, "^(?i)h323$$") OR match(transporttype, "^(?i)sip$$"),CDinsec) &lt;BR /&gt;
| stats avg("Voice_count") as Avg_Voice, avg("Video_count") as Avg_Video, sum("Voice_count") as Sum_Voice, sum("Video_count") as Sum_Video by Name&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;query2:&lt;/STRONG&gt;&lt;BR /&gt;
index="monthlycdr" $result0sec$ $result$ |  eval "Call Duration"=replace('Call Duration',"\"","") | convert dur2sec("Call Duration") as "CDinsec" |  eval "Name"=replace('Name',"\"","") | eval "transporttype"=replace('Transport Type',"\"","")  | eval "Voice_count"=case( match(transporttype, "(?i)voice") OR match(transporttype, "(?i)pstn"), CDinsec) &lt;BR /&gt;
|  eval "Video_count" =case(match(transporttype, "^(?i)h323$$") OR match(transporttype, "^(?i)sip$$"),CDinsec) &lt;BR /&gt;
| stats avg("Voice_count") as Avg_Voice, avg("Video_count") as Avg_Video, sum("Voice_count") as Sum_Voice, sum("Video_count") as Sum_Video by Name&lt;/P&gt;

&lt;P&gt;How can I make my dashboard panel to run query 1 if the token value is "All", and if else for query 2, else for maybe other query? Can I do this with splunk?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:14:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-else-condition-for-dashboard/m-p/340741#M22143</guid>
      <dc:creator>tamduong16</dc:creator>
      <dc:date>2020-09-29T17:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: If else condition for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-else-condition-for-dashboard/m-p/340742#M22144</link>
      <description>&lt;P&gt;Put both panels in the same place, and set a token for &lt;CODE&gt;depends&lt;/CODE&gt; in one, and for &lt;CODE&gt;rejects&lt;/CODE&gt; in the other.  When the token exists, the &lt;CODE&gt;depends&lt;/CODE&gt; panel will show, when the token does NOT exist, then the &lt;CODE&gt;rejects&lt;/CODE&gt; panel will show. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.3/Viz/tokens"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.3/Viz/tokens&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.3/Viz/PanelreferenceforSimplifiedXML"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.3/Viz/PanelreferenceforSimplifiedXML&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 21:31:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-else-condition-for-dashboard/m-p/340742#M22144</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-12-14T21:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: If else condition for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-else-condition-for-dashboard/m-p/340743#M22145</link>
      <description>&lt;P&gt;something like this might get you started (you will need two panels, though, but only one will show based on the input):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="type" token="token"&amp;gt;
      &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
      &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
OTHER CHOICES
       &amp;lt;change&amp;gt;
         &amp;lt;condition&amp;gt;
            &amp;lt;set token="pan2"&amp;gt;&amp;amp;#32;&amp;lt;/set&amp;gt;
            &amp;lt;unset token="pan1"&amp;gt;&amp;lt;/unset&amp;gt;&amp;lt;/condition&amp;gt;
        &amp;lt;condition value="*"&amp;gt;
            &amp;lt;set token="pan1"&amp;gt;&amp;amp;#32;&amp;lt;/set&amp;gt;
            &amp;lt;unset token="pan2"&amp;gt;&amp;lt;/unset&amp;gt;
          &amp;lt;/condition&amp;gt;
        &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then use $pan1$ and $pan2$ in the searches: index=monthlycdr $result0sec$ $result$ $pan1$&lt;/P&gt;

&lt;P&gt;and use &lt;CODE&gt;&amp;lt;panel depends=$pan1$&amp;gt;&lt;/CODE&gt; in the panel that has that token in it, etc. you might need to edit it a bit. &lt;BR /&gt;
&lt;A href="https://www.splunk.com/blog/2017/06/29/load-em-up-and-move-em-out-controlling-dashboard-panel-load-order.html"&gt;https://www.splunk.com/blog/2017/06/29/load-em-up-and-move-em-out-controlling-dashboard-panel-load-order.html&lt;/A&gt;&lt;BR /&gt;
this is a blog post for help on it.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 21:33:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-else-condition-for-dashboard/m-p/340743#M22145</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-12-14T21:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: If else condition for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-else-condition-for-dashboard/m-p/340744#M22146</link>
      <description>&lt;P&gt;You can also use &lt;CODE&gt;&amp;lt;condition label="YOUR_CHOICE_LABEL"&amp;gt;&lt;/CODE&gt; which is good for when you have a choice of "All" with value of "*".  &lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 16:43:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-else-condition-for-dashboard/m-p/340744#M22146</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2019-07-01T16:43:48Z</dc:date>
    </item>
  </channel>
</rss>

