<?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 statemnt not working with Tokens in dashboard in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750609#M59001</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/311980"&gt;@lokeshchanana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simple XML tokens are case-sensitive. You must use $searchCriteria$—matching the capitalization in your input name&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval search_col = if("$searchCriteria$"=="s_user", user, path)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Also you can &lt;STRONG&gt;use case()&lt;/STRONG&gt; with token substitution,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval search_col = case("$searchCriteria$"=="s_user", user, 1==1, path)&lt;/LI-CODE&gt;&lt;P&gt;This forces Splunk to treat "$searchCriteria$" as a string literal and compare it properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Prewin&lt;BR /&gt;Splunk Enthusiast | Always happy to help! If this answer helped you, please consider marking it as the solution or giving a Karma. Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jul 2025 04:23:49 GMT</pubDate>
    <dc:creator>PrewinThomas</dc:creator>
    <dc:date>2025-07-29T04:23:49Z</dc:date>
    <item>
      <title>If statement not working with Tokens in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750603#M59000</link>
      <description>&lt;P&gt;I am making a dashboard with the dropdown input called $searchCriteria$. I am trying to set the value of a search_col based on the value of the $searchCriteria$ token. I have tried the following:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;| eval search_col = if($searchcriteria$ == "s_user", user, path)&lt;/P&gt;&lt;P&gt;| eval search_col = if('$searchcriteria$' == "s_user", user, path)&lt;/P&gt;&lt;P&gt;| eval search_col = if($searchcriteria$ == 's_user', user, path)&lt;/P&gt;&lt;P&gt;| eval search_col = if('$searchcriteria$' == 's_user', user, path)&lt;BR /&gt;&lt;BR /&gt;Even tried&amp;nbsp;&lt;/P&gt;&lt;P&gt;| eval search_col = if(s_user == s_user, user, path)&lt;BR /&gt;&lt;BR /&gt;The value of search_col is the same as path.&amp;nbsp;&lt;BR /&gt;I have tested, and the value of the $searchcriteria$ is getting set properly.&lt;BR /&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 05:52:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750603#M59000</guid>
      <dc:creator>lokeshchanana</dc:creator>
      <dc:date>2025-07-29T05:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: If statemnt not working with Tokens in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750609#M59001</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/311980"&gt;@lokeshchanana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simple XML tokens are case-sensitive. You must use $searchCriteria$—matching the capitalization in your input name&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval search_col = if("$searchCriteria$"=="s_user", user, path)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Also you can &lt;STRONG&gt;use case()&lt;/STRONG&gt; with token substitution,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval search_col = case("$searchCriteria$"=="s_user", user, 1==1, path)&lt;/LI-CODE&gt;&lt;P&gt;This forces Splunk to treat "$searchCriteria$" as a string literal and compare it properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Prewin&lt;BR /&gt;Splunk Enthusiast | Always happy to help! If this answer helped you, please consider marking it as the solution or giving a Karma. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 04:23:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750609#M59001</guid>
      <dc:creator>PrewinThomas</dc:creator>
      <dc:date>2025-07-29T04:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: If statemnt not working with Tokens in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750610#M59002</link>
      <description>&lt;P&gt;Almost! Yes, using the correct case for the token is vital, but it is putting the token in double quotes which is also vital. Using &lt;STRONG&gt;case&lt;/STRONG&gt; instead of &lt;STRONG&gt;if&lt;/STRONG&gt; is not important.&lt;/P&gt;&lt;P&gt;Token values are substituted as a text substitution into the code of the dashboard (whether Studio or SimpleXML) before the dashboard code is executed. For example, if the searchCriteria token from the dropdown had the value "s_user", the&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval search_col = if($searchCriteria$ == "s_user", user, path)&lt;/LI-CODE&gt;&lt;P&gt;line would become&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval search_col = if(s_user == "s_user", user, path)&lt;/LI-CODE&gt;&lt;P&gt;i.e. if the s_user &lt;EM&gt;field&lt;/EM&gt; has the string value "s_user". Using double quotes&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval search_col = if("$searchCriteria$" == "s_user", user, path)&lt;/LI-CODE&gt;&lt;P&gt;gives the line the intended meaning&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval search_col = if("s_user" == "s_user", user, path)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 05:53:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750610#M59002</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2025-07-29T05:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working with Tokens in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750614#M59003</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/311980"&gt;@lokeshchanana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Case sensitivity of the token is certainly causing you an issue here, if the token you're setting is "searchCriteria" then your cannot use "searchcriteria".&lt;/P&gt;&lt;P&gt;Also, you can use &lt;A href="https://help.splunk.com/en/splunk-enterprise/forward-and-process-data/universal-forwarder-manual/9.4/working-with-the-universal-forwarder/manage-a-linux-least-privileged-user?_gl=1*1wpksbt*_gcl_au*OTk5Nzg2MDQzLjE3NDkxMDg3ODA.*FPAU*OTk5Nzg2MDQzLjE3NDkxMDg3ODA.*_ga*NjYxOTc5OTIuMTc0MDY0NjI5Mg..*_ga_5EPM2P39FV*czE3NTM3Njk2NTckbzE0MCRnMSR0MTc1Mzc3MDAwMSRqMiRsMCRoNTQzNDg4Nzg4*_fplc*VVFpVSUyQnhPJTJCNzZTbWRoVTQ0N1JQaHZFVSUyQnIlMkYlMkI1OFEzUVE5aHJxaGZIZkwwY0VzT1JPWDRzZWglMkJsbzZIcktxMFFKbm1DbkluY3NsNVZDUk1GamhTUHBVekRhR2tXSnIyRnd3cWg2MWt2MXlzb3UlMkZ3RGx2c3A1SDVYbWZsWWclM0QlM0Q." target="_self"&gt;Token filters&lt;/A&gt;&amp;nbsp;to add quotes around the token if you prefer, so&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval search_col = if($searchCriteria|s$ == "s_user", user, path)&lt;/LI-CODE&gt;&lt;P&gt;should also be the same as:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval search_col = if("$searchCriteria$" == "s_user", user, path)&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 06:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750614#M59003</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-07-29T06:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working with Tokens in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750619#M59004</link>
      <description>&lt;P&gt;Strictly speaking, &lt;FONT face="courier new,courier"&gt;"$searchCriteria$"&lt;/FONT&gt; is not the same as &lt;FONT face="courier new,courier"&gt;$searchCriteria|s$&lt;/FONT&gt; as the &lt;FONT face="courier new,courier"&gt;|s&lt;/FONT&gt; filter will deal with things such as embedded quotes, whereas just putting the token in double quotes will not. Having said that, in this instance, they are probably equivalent.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 06:52:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750619#M59004</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2025-07-29T06:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working with Tokens in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750689#M59008</link>
      <description>&lt;P&gt;I am sorry for the typing mistake. The Token name is&amp;nbsp;searchcriteria, there is no difference in the case:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lokeshchanana_0-1753823367015.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/39781i17B3266292FC97A0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lokeshchanana_0-1753823367015.png" alt="lokeshchanana_0-1753823367015.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I know case difference is an issue, but I have made sure there is no case difference, and I am still having the same issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 21:10:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750689#M59008</guid>
      <dc:creator>lokeshchanana</dc:creator>
      <dc:date>2025-07-29T21:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working with Tokens in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750692#M59009</link>
      <description>&lt;P&gt;Thanks for your reply. I have checked the case and for the special characters, I even changed the token name from&amp;nbsp;search_criteria to&amp;nbsp;searchcriteria&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 21:12:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750692#M59009</guid>
      <dc:creator>lokeshchanana</dc:creator>
      <dc:date>2025-07-29T21:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working with Tokens in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750698#M59010</link>
      <description>&lt;P&gt;What exactly is not working? Please share your search where you are using the token?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 22:02:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/If-statement-not-working-with-Tokens-in-dashboard/m-p/750698#M59010</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2025-07-29T22:02:14Z</dc:date>
    </item>
  </channel>
</rss>

