<?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 Initialize Token As Default Values Then Insert Latest Values When New Values Received in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336533#M21836</link>
    <description>&lt;P&gt;Hi guys i currently facing an issues need to default token as default values let said 'zero' when there is no values received. However it will change when new values are received. I no sure which part of of code went wrong. I can't event put a condition for default it. Mind to share? Below is my code:&lt;/P&gt;

&lt;P&gt;Hi guys, currently i facing an issues which need initialize my token as any value 1st. However the token values will change when a new values received. Below is my code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search id="header"&amp;gt;
&amp;lt;query&amp;gt;index="rtindex" Label="CH1" Order="12" |eval Value=round(Value,3) |stats latest(Value) as Value by ID2 |rename ID2 as Label | untable Label field name | xyseries field Label name&amp;lt;/query&amp;gt;
&amp;lt;earliest&amp;gt;@d&amp;lt;/earliest&amp;gt;
&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;preview&amp;gt;
  &amp;lt;set token="FLOW_LPS"&amp;gt;$result.CH1_CHW_FLOW_LPS$&amp;lt;/set&amp;gt;
  &amp;lt;set token="FLOW"&amp;gt;$result.CH1_CHW_FLOW$&amp;lt;/set&amp;gt;
  &amp;lt;set token="COOLING_LOAD"&amp;gt;$result.CH1_COOLING_LOAD$&amp;lt;/set&amp;gt;
  &amp;lt;set token="EFF"&amp;gt;$result.CH1_EFF$&amp;lt;/set&amp;gt;
&amp;lt;/preview&amp;gt;


&amp;lt;table id="Chiller_1" border="1px solid black"&amp;gt; 
      &amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;HEADER Details &amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Values&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;
       &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;CHWF (USGPM)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$CH1_CHW_FLOW$&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt; 
       &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;FLOW (LPS)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$CH1_CHW_FLOW_LPS$&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
       &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;COOLING LOAD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$CH1_COOLING_LOAD$&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;  
       &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;KW/Ton&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$CH1_EFF$&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt; 
 &amp;lt;/table&amp;gt;  
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 Mar 2017 02:42:46 GMT</pubDate>
    <dc:creator>qygoh</dc:creator>
    <dc:date>2017-03-06T02:42:46Z</dc:date>
    <item>
      <title>Initialize Token As Default Values Then Insert Latest Values When New Values Received</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336533#M21836</link>
      <description>&lt;P&gt;Hi guys i currently facing an issues need to default token as default values let said 'zero' when there is no values received. However it will change when new values are received. I no sure which part of of code went wrong. I can't event put a condition for default it. Mind to share? Below is my code:&lt;/P&gt;

&lt;P&gt;Hi guys, currently i facing an issues which need initialize my token as any value 1st. However the token values will change when a new values received. Below is my code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search id="header"&amp;gt;
&amp;lt;query&amp;gt;index="rtindex" Label="CH1" Order="12" |eval Value=round(Value,3) |stats latest(Value) as Value by ID2 |rename ID2 as Label | untable Label field name | xyseries field Label name&amp;lt;/query&amp;gt;
&amp;lt;earliest&amp;gt;@d&amp;lt;/earliest&amp;gt;
&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&amp;lt;preview&amp;gt;
  &amp;lt;set token="FLOW_LPS"&amp;gt;$result.CH1_CHW_FLOW_LPS$&amp;lt;/set&amp;gt;
  &amp;lt;set token="FLOW"&amp;gt;$result.CH1_CHW_FLOW$&amp;lt;/set&amp;gt;
  &amp;lt;set token="COOLING_LOAD"&amp;gt;$result.CH1_COOLING_LOAD$&amp;lt;/set&amp;gt;
  &amp;lt;set token="EFF"&amp;gt;$result.CH1_EFF$&amp;lt;/set&amp;gt;
&amp;lt;/preview&amp;gt;


&amp;lt;table id="Chiller_1" border="1px solid black"&amp;gt; 
      &amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;HEADER Details &amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Values&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;
       &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;CHWF (USGPM)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$CH1_CHW_FLOW$&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt; 
       &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;FLOW (LPS)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$CH1_CHW_FLOW_LPS$&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
       &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;COOLING LOAD&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$CH1_COOLING_LOAD$&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;  
       &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;KW/Ton&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$CH1_EFF$&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt; 
 &amp;lt;/table&amp;gt;  
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2017 02:42:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336533#M21836</guid>
      <dc:creator>qygoh</dc:creator>
      <dc:date>2017-03-06T02:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize Token As Default Values Then Insert Latest Values When New Values Received</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336534#M21837</link>
      <description>&lt;P&gt;It will really help to explain how things should work when users do certain things on your form.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 04:37:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336534#M21837</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-06T04:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize Token As Default Values Then Insert Latest Values When New Values Received</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336535#M21838</link>
      <description>&lt;P&gt;This is a page to display all the values when user navigate to this page. However there are certain fields without any value and it will showed $CH1_COOLING_LOAD$. i wish to default it as zero for those field without values. Did you have any idea how should i handle it? Thank you very much.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:06:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336535#M21838</guid>
      <dc:creator>qygoh</dc:creator>
      <dc:date>2020-09-29T13:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize Token As Default Values Then Insert Latest Values When New Values Received</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336536#M21839</link>
      <description>&lt;P&gt;If you are on Splunk 6.5 there is new &lt;STRONG&gt;init&lt;/STRONG&gt; section to initialize tokens for the first time.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Application Monitoring: Exchange&amp;lt;/label&amp;gt;
  &amp;lt;init&amp;gt;
    &amp;lt;set token="app_name"&amp;gt;my_app_name&amp;lt;/set&amp;gt;
  &amp;lt;/init&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Refer to the documentation below: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Set_tokens_on_page_load"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Set_tokens_on_page_load&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;However, your actual requirement is not to initialize token rather to default token when the value is not present. You can use &lt;STRONG&gt;eval&lt;/STRONG&gt; for setting such tokens. using &lt;CODE&gt;result.&amp;lt;Yourfieldname&amp;gt;&lt;/CODE&gt; you can access only one or rather first value of the field name. In other words result will be useful only when your query returns only single row of results.&lt;BR /&gt;
As per your code &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;preview&amp;gt;
   &amp;lt;eval token="FLOW_LPS"&amp;gt;if(isnull($result.CH1_CHW_FLOW_LPS$),0,$result.CH1_CHW_FLOW_LPS$)&amp;lt;/eval&amp;gt;
   ...
   ...&amp;lt;renaminig eval statements similar to above&amp;gt;...
   ....
 &amp;lt;/preview&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2017 07:17:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336536#M21839</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-03-06T07:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize Token As Default Values Then Insert Latest Values When New Values Received</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336537#M21840</link>
      <description>&lt;P&gt;It work perfectly!!! Thank you very much for your help. At 1st i try using:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;set token="app_name"&amp;gt;my_app_name&amp;lt;/set&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It give me error message and i not sure why. After i check it and i realize my splunk version is 6.4. You save my day bro. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 01:33:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336537#M21840</guid>
      <dc:creator>qygoh</dc:creator>
      <dc:date>2017-03-07T01:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize Token As Default Values Then Insert Latest Values When New Values Received</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336538#M21841</link>
      <description>&lt;P&gt;@qygoh Anytime... glad it worked!!!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 19:51:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336538#M21841</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-03-07T19:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize Token As Default Values Then Insert Latest Values When New Values Received</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336539#M21842</link>
      <description>&lt;P&gt;there is a pre-defined environment variable so you do not ahve to hard code.&lt;BR /&gt;
$env:app$ &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.2.1/Viz/tokens#Use_global_tokens_to_access_environment_information"&gt;http://docs.splunk.com/Documentation/Splunk/7.2.1/Viz/tokens#Use_global_tokens_to_access_environment_information&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 13:29:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Initialize-Token-As-Default-Values-Then-Insert-Latest-Values/m-p/336539#M21842</guid>
      <dc:creator>fk319</dc:creator>
      <dc:date>2018-12-13T13:29:01Z</dc:date>
    </item>
  </channel>
</rss>

