<?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: Search query within IF statement? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-query-within-IF-statement/m-p/704769#M57744</link>
    <description>&lt;P&gt;Thank you!&lt;BR /&gt;&lt;BR /&gt;I'm working on reproducing this in json format for Dashboard Studio, and keep getting an error that the input myast have a 'type' specified... any guidance on what that would need to be?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2024 20:49:54 GMT</pubDate>
    <dc:creator>rwheeloc</dc:creator>
    <dc:date>2024-11-19T20:49:54Z</dc:date>
    <item>
      <title>Search query within IF statement?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-query-within-IF-statement/m-p/704733#M57742</link>
      <description>&lt;P&gt;I'm trying to come up with a search query that ignores parameters if left blank, but ignores other parameters if filled in.&lt;/P&gt;&lt;P&gt;In this case, "-" is the default value for token1 and token2. If token1 and token2 are left at this default, I want to find results based only on token3; but if token1 or token2 are specified then I want token3 to be disregarded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what I've been trying, but so far doesn't seem to be working as I'd hoped:&lt;/P&gt;&lt;PRE&gt;if(($token1$ == "-" AND $token2$ =="-"), (search Field3=$token3$), (search Field1="$token1$" OR Field2="$token2$"))&lt;/PRE&gt;&lt;P&gt;Am I on the right track? Something I'm missing?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 15:55:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-query-within-IF-statement/m-p/704733#M57742</guid>
      <dc:creator>rwheeloc</dc:creator>
      <dc:date>2024-11-19T15:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Search query within IF statement?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-query-within-IF-statement/m-p/704745#M57743</link>
      <description>&lt;P&gt;SPL does not have conditional execution.&amp;nbsp; The if function (not a command or statement) is part of &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; expressions to help determine the value to test or assign to a field.&lt;/P&gt;&lt;P&gt;In dashboards, conditional execution can be simulated by assigning different search commands to a token based on the value of other tokens.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;input&amp;gt;
...
  &amp;lt;condition $token1="-" AND $token2$="-"&amp;gt;  &amp;lt;!-- not the correct syntax--&amp;gt;
    &amp;lt;set token="search"&amp;gt;Field3=$token$&amp;lt;/set&amp;gt;
  &amp;lt;/condition&amp;gt;
  &amp;lt;condition&amp;gt;
    &amp;lt;set token="search"&amp;gt;Field11=$token1"&amp;lt;/set&amp;gt;
  &amp;lt;/condition&amp;gt;
&amp;lt;/input&amp;gt;
...
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;index=foo $search$&amp;lt;/query&amp;gt;
  &amp;lt;/search&amp;gt;
...&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Nov 2024 16:19:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-query-within-IF-statement/m-p/704745#M57743</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-11-19T16:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Search query within IF statement?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-query-within-IF-statement/m-p/704769#M57744</link>
      <description>&lt;P&gt;Thank you!&lt;BR /&gt;&lt;BR /&gt;I'm working on reproducing this in json format for Dashboard Studio, and keep getting an error that the input myast have a 'type' specified... any guidance on what that would need to be?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 20:49:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-query-within-IF-statement/m-p/704769#M57744</guid>
      <dc:creator>rwheeloc</dc:creator>
      <dc:date>2024-11-19T20:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Search query within IF statement?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-query-within-IF-statement/m-p/704772#M57745</link>
      <description>&lt;P&gt;My example is more like pseudo-code than something you could paste into a dashboard.&amp;nbsp; No doubt there are many blanks to be filled in.&lt;/P&gt;&lt;P&gt;JSON input types are in the manual at &lt;A href="https://docs.splunk.com/Documentation/Splunk/9.3.2/DashStudio/" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.3.2/DashStudio/&lt;/A&gt;inputConfig#Input_configuration_options_available_in_the_visual_editor&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 21:13:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-query-within-IF-statement/m-p/704772#M57745</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-11-19T21:13:05Z</dc:date>
    </item>
  </channel>
</rss>

