<?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 need to replace splunk dashboard tokens to * if they are undefined in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/need-to-replace-splunk-dashboard-tokens-to-if-they-are-undefined/m-p/466093#M30586</link>
    <description>&lt;P&gt;I have two TEXT fields Object and modifier. I want to create dashboard based on either of the field. tried with "if condition", it did not work.&lt;BR /&gt;
Javascript is also fine&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
field1=object&lt;BR /&gt;
field2=modifier&lt;/P&gt;

&lt;P&gt;| index=name event=$object$ action=$modifier$ |table content group&lt;/P&gt;

&lt;P&gt;--&amp;gt;if both fields are provided no worries&lt;BR /&gt;
--&amp;gt;if both are not provided then both should be "wildcard(star)"&lt;BR /&gt;
--&amp;gt;if field1 is specified and field2 is not specified then field2 should be "wildcard(star)"&lt;BR /&gt;
--&amp;gt;if field2 is specified and field1 is not specified then field1 should be "*"&lt;/P&gt;

&lt;P&gt;How to achieve this?&lt;/P&gt;

&lt;P&gt;Note:I dont want to achieve this by using * in default value&lt;/P&gt;

&lt;P&gt;Thanks.&lt;BR /&gt;
Kranthi M&lt;/P&gt;</description>
    <pubDate>Fri, 25 Oct 2019 09:45:07 GMT</pubDate>
    <dc:creator>kranthimutyala</dc:creator>
    <dc:date>2019-10-25T09:45:07Z</dc:date>
    <item>
      <title>need to replace splunk dashboard tokens to * if they are undefined</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/need-to-replace-splunk-dashboard-tokens-to-if-they-are-undefined/m-p/466093#M30586</link>
      <description>&lt;P&gt;I have two TEXT fields Object and modifier. I want to create dashboard based on either of the field. tried with "if condition", it did not work.&lt;BR /&gt;
Javascript is also fine&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
field1=object&lt;BR /&gt;
field2=modifier&lt;/P&gt;

&lt;P&gt;| index=name event=$object$ action=$modifier$ |table content group&lt;/P&gt;

&lt;P&gt;--&amp;gt;if both fields are provided no worries&lt;BR /&gt;
--&amp;gt;if both are not provided then both should be "wildcard(star)"&lt;BR /&gt;
--&amp;gt;if field1 is specified and field2 is not specified then field2 should be "wildcard(star)"&lt;BR /&gt;
--&amp;gt;if field2 is specified and field1 is not specified then field1 should be "*"&lt;/P&gt;

&lt;P&gt;How to achieve this?&lt;/P&gt;

&lt;P&gt;Note:I dont want to achieve this by using * in default value&lt;/P&gt;

&lt;P&gt;Thanks.&lt;BR /&gt;
Kranthi M&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 09:45:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/need-to-replace-splunk-dashboard-tokens-to-if-they-are-undefined/m-p/466093#M30586</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2019-10-25T09:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: need to replace splunk dashboard tokens to * if they are undefined</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/need-to-replace-splunk-dashboard-tokens-to-if-they-are-undefined/m-p/466094#M30587</link>
      <description>&lt;P&gt;Hi @kranthimutyala ,&lt;/P&gt;

&lt;P&gt;I think what you can do here is have one more layer of token through javascript. Where changing the filter will cause these next layer of tokens to update which are set by your logic.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;P&gt;Lets say you have filter token named as &lt;CODE&gt;$filter_token$&lt;/CODE&gt;. So what you can do is have &lt;CODE&gt;onChange&lt;/CODE&gt; event listener on this token and inside that you can check for value of the token and according to that set another token named &lt;CODE&gt;$search_token$&lt;/CODE&gt; which will be used in the query. That way you can keep the text input empty and on page load you can initialize &lt;CODE&gt;$search_token$&lt;/CODE&gt; to be &lt;CODE&gt;*&lt;/CODE&gt; which won't show up on the text input that you are displaying.&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;BR /&gt;
Harsh&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 10:16:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/need-to-replace-splunk-dashboard-tokens-to-if-they-are-undefined/m-p/466094#M30587</guid>
      <dc:creator>harshpatel</dc:creator>
      <dc:date>2019-10-25T10:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: need to replace splunk dashboard tokens to * if they are undefined</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/need-to-replace-splunk-dashboard-tokens-to-if-they-are-undefined/m-p/466095#M30588</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The below answer may solve your issue.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/777312/handling-splunk-dashboard-token.html"&gt;https://answers.splunk.com/answers/777312/handling-splunk-dashboard-token.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 14:05:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/need-to-replace-splunk-dashboard-tokens-to-if-they-are-undefined/m-p/466095#M30588</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-10-25T14:05:25Z</dc:date>
    </item>
  </channel>
</rss>

