<?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: help with the dashboard time calculation needed in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/help-with-the-dashboard-time-calculation-needed/m-p/499538#M85138</link>
    <description>&lt;P&gt;$form.to$ and $form.from$ are strings and you can't subtract strings.  Use the integer form of each time, instead.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;eval token="timediff"&amp;gt;relative_time(now(), 'latest') - relative_time(now(), 'earliest')&amp;lt;/eval&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 31 Jan 2020 13:43:58 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-01-31T13:43:58Z</dc:date>
    <item>
      <title>help with the dashboard time calculation needed</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/help-with-the-dashboard-time-calculation-needed/m-p/499536#M85136</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have relatively easy issue I am struggling with.&lt;BR /&gt;
I would like to calculate the time difference in seconds between the form.to and form.from set from the time picker. The dashboard beginning looks as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;System KPI Dashboard Clone&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false" autoRun="true"&amp;gt;
    &amp;lt;input type="dropdown" token="sysid" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;System&amp;lt;/label&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;SYSYSID&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;SYSYSID&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;| dbxquery query="select distinct sysysid from sapiop.zkpic_sysreltask where hana = 'X' order by sysysid" connection="HANA_MLBSO"&amp;lt;/query&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/search&amp;gt;
      &amp;lt;default&amp;gt;ISP&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="time" token="field1" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Time&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;eval token="form.from"&amp;gt;strftime(relative_time(now(),'earliest'), "%F %T")&amp;lt;/eval&amp;gt;
        &amp;lt;eval token="form.to"&amp;gt;strftime(relative_time(now(),'latest'), "%F %T")&amp;lt;/eval&amp;gt;
        &amp;lt;eval token="timediff"&amp;gt;$form.to$ - "$form.from$&amp;lt;/eval&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel depends="$hidden$"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However the timediff does not get set.&lt;BR /&gt;
I tried different combinations with relative_time, etc. but is seems not to get set.&lt;BR /&gt;
How would I do it?&lt;/P&gt;

&lt;P&gt;Kind regards,&lt;BR /&gt;
Kamil&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 12:32:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/help-with-the-dashboard-time-calculation-needed/m-p/499536#M85136</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2020-01-31T12:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: help with the dashboard time calculation needed</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/help-with-the-dashboard-time-calculation-needed/m-p/499537#M85137</link>
      <description>&lt;P&gt;I solved the issue, was actually not that difficult ...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;eval token="form.from"&amp;gt;strftime(relative_time(now(),'earliest'), "%Y-%m-%d %H:%M:%S")&amp;lt;/eval&amp;gt;
&amp;lt;eval token="form.to"&amp;gt;strftime(relative_time(now(),'latest'), "%Y-%m-%d %H:%M:%S")&amp;lt;/eval&amp;gt;
&amp;lt;eval token="timediff"&amp;gt;strptime($form.to$, "%Y-%m-%d %H:%M:%S")  - strptime($form.from$, "%Y-%m-%d %H:%M:%S")&amp;lt;/eval&amp;gt; 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Jan 2020 13:43:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/help-with-the-dashboard-time-calculation-needed/m-p/499537#M85137</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2020-01-31T13:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: help with the dashboard time calculation needed</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/help-with-the-dashboard-time-calculation-needed/m-p/499538#M85138</link>
      <description>&lt;P&gt;$form.to$ and $form.from$ are strings and you can't subtract strings.  Use the integer form of each time, instead.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;eval token="timediff"&amp;gt;relative_time(now(), 'latest') - relative_time(now(), 'earliest')&amp;lt;/eval&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Jan 2020 13:43:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/help-with-the-dashboard-time-calculation-needed/m-p/499538#M85138</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-01-31T13:43:58Z</dc:date>
    </item>
  </channel>
</rss>

