<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Time related issue</title><link>https://community.appian.com/discussions/f/data/18071/time-related-issue</link><description>Hi , 
 
 I have two date start date and end date , and i want time duration in days but the problem is data is coming from task report . 
 
 a!gridTextColumn( label:&amp;quot;Start Date&amp;quot;, field:&amp;quot;c6&amp;quot;, data:index(local!dataset.data,&amp;quot;c3&amp;quot;,{}) ), 
 
 and 
 a!gridTextColumn</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71100?ContentTypeID=1</link><pubDate>Fri, 20 Dec 2019 08:02:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cddd8938-cbd7-435b-bf2a-f9309a119080</guid><dc:creator>danb0002</dc:creator><description>&lt;p&gt;Thanks Peter , I got my solution&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71094?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 19:27:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:933fa25f-bedd-4bcf-89c2-2a2d4ddf6290</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Agreed with Mike - troubleshooting is much easier one at a time. Also, since you&amp;#39;re looking for just the days, I&amp;#39;d suggest putting floor() around your interval result, which should give you the number of days in an integer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71091?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 17:29:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b15656f7-8772-4320-8b1c-b33cb236afeb</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I suggest you write an expression rule called something like &amp;quot;APP_getElapsedDaysBetweenDates&amp;quot; that accepts two DATETIME parameters and returns a result that matches what you are after - i.e. whole numbers (0, 1, etc) for business days, or decimals to represent days and partial days, and also handles null-checking on either or both of the inputs.&amp;nbsp; After that, you can simply call that rule and pass in the two columns from your report within the logic of your a!forEach statement.&amp;nbsp; Doing it this way will make it much more easy to initially test that the math you&amp;#39;re trying to do is both working without error, and returning the exact return value you&amp;#39;re expecting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71090?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 17:23:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:204cf99d-ef7a-4203-bf9e-6a44d253810b</guid><dc:creator>danb0002</dc:creator><description>&lt;p&gt;Hi Peter i understand that but I&amp;#39;m getting the result&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;table class="PagingGridLayout---table PagingGridLayout---scrollable PagingGridLayout---striped"&gt;
&lt;tbody&gt;
&lt;tr class=""&gt;
&lt;td class=""&gt;
&lt;p class="ParagraphText---richtext_paragraph ParagraphText---default_direction ParagraphText---align_start elements---global_p"&gt;0::00:00:11.207&lt;/p&gt;
&lt;/td&gt;
&lt;td class=""&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;which i don&amp;#39;t need that i need this result only in days . because some task assigned in same date and completed in same date so for that scenario it should be 0 .... i hope you are getting my point&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71089?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 17:23:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fe0b868b-4172-4ddf-9b88-f827a4eeb3b7</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;You would be able to handle this case in the logic of your a!forEach() expression once you get the math working for non-null cases.&amp;nbsp; Just wrap the expression in an if() statement where you check i.e. &amp;quot;isnull(fv!item.c3)&amp;quot; and return a different value in that case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71087?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 17:18:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1b8ffd7d-0832-4f39-8947-661905f38e74</guid><dc:creator>danb0002</dc:creator><description>&lt;p&gt;in some case start date is null&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71086?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 17:03:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:19e295c4-b9b4-4787-929c-da887ea5873f</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;FYI,&amp;nbsp;&lt;a href="/members/danb0002"&gt;danb0002&lt;/a&gt;&amp;nbsp;-&amp;nbsp;you can also do a lot of this troubleshooting yourself in a blank Expression Rule editor window, testing out what operators work with which date/datetime values, etc.&amp;nbsp; That&amp;#39;s what a lot of us do ourselves when providing support.&lt;/p&gt;
&lt;p&gt;For ex.&lt;pre class="ui-code" data-mode="text"&gt;with(
  local!today: datetime(2019, 12, 19, 15, 47),
  local!pastDate: datetime(2019, 12, 14, 07, 33),
  
  todecimal(local!today - local!pastDate)
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71085?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 16:58:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9b9d5228-b382-4256-8bd8-58e2e9339df6</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Actually I think you might need it like this then:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!gridTextColumn(
  label: &amp;quot;Duration&amp;quot;,
  data: a!forEach(
    items: local!dataset.data,
    expression: todecimal(todatetime(fv!item.c11) - todatetime(fv!item.c3))
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71084?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 16:51:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:43dda406-e507-4b13-8c38-59c71c987c88</guid><dc:creator>danb0002</dc:creator><description>&lt;p&gt;Hi Please understand my situation i have two date Start Date and End Date&amp;nbsp;&lt;/p&gt;
&lt;p&gt;for start date&amp;nbsp;&lt;span&gt;data:index(local!dataset.data,&amp;quot;c3&amp;quot;,{}) and End date&amp;nbsp;data:index(local!dataset.data,&amp;quot;c11&amp;quot;,{}) in grid&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;i need to subtract these two date ( end date - start date ) to get the duration in days&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;EX- Jan&amp;nbsp;6, 2019 11:34 AM start date&amp;nbsp; and end date is Feb&amp;nbsp;5, 2019 11:34 AM&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71080?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 14:49:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:659dd2c7-bd2b-4034-9359-68bd0672b684</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure what all you might have so far, but to resolve that error perhaps try this instead:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;expression: todecimal(fv!item.c11) - todecimal(fv!item.c3)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71079?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 14:42:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:77ae8e29-bbe4-45a5-aa97-48b3d576b1e0</guid><dc:creator>danb0002</dc:creator><description>&lt;p&gt;&lt;span&gt;getting this error&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Expression evaluation error at function &amp;#39;todecimal&amp;#39; parameter 1 [line 92]: Cannot sub incompatible operands of type Any Type and type Any Type.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71078?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 14:13:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a688691c-bbfa-4472-a9b7-623df575e4df</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;&amp;nbsp;If you need to do this in a grid, just reference both of your columns using a!forEach(). Here&amp;#39;s an example of how you can set up the column:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!gridTextColumn(
  label: &amp;quot;Duration&amp;quot;,
  data: a!forEach(
    items: local!dataset.data,
    expression: todecimal(fv!item.c11 - fv!item.c3)
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I used the decimal because it will give you a count in days - if you want to format it differently, you might have to parse out the parts of the interval (see davidl&amp;#39;s post above mine).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71076?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 13:35:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:50b95912-414a-49f3-a8ad-1929c08f23ca</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;I tried this:&lt;/p&gt;
&lt;p&gt;datetime(2011, 12, 13, 12, 0, 0) - datetime(2011, 12, 10, 10, 0, 0)&lt;/p&gt;
&lt;p&gt;in one of the example boxes, and this was the result:&lt;/p&gt;
&lt;table class="expbox-results"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;Type&lt;/b&gt;&lt;/td&gt;
&lt;td id="typeCell"&gt;Interval (Day to Second)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;Value&lt;/b&gt;&lt;/td&gt;
&lt;td id="valueCell"&gt;3::02:00:00.000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;It&amp;#39;s Interval format, 3 days and 2 hours.&amp;nbsp; So&amp;nbsp;the&amp;nbsp;- (minus) operator should take care of it.&lt;/p&gt;
&lt;p&gt;Let us know if you have further problems.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71073?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 08:47:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c28829a7-2c5b-4d02-ae2b-91888baf6d6f</guid><dc:creator>danb0002</dc:creator><description>&lt;p&gt;i want subtract start date and end date ... to get time in duration .... is it possible&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jun 9, 2019 11:34 AM start date&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Aug 6, 2019 11:34 AM end date&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time related issue</title><link>https://community.appian.com/thread/71067?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 18:53:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6ba1f34e-e173-4c55-b810-6ee8896dba8c</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;What have you tried so far / what exactly is the problem you&amp;#39;re having?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>