<?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: calculate difference between two dates in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277867#M53509</link>
    <description>hi Shong, 
&lt;BR /&gt;Thanks for the reply. 
&lt;BR /&gt;I have implemented this already I used tJavaFlex&amp;nbsp;to write a conditional expression to calculate the difference of two dates and store the return value in cnt variable which is already defined as integer but I am keep on getting Type mismatch: cannot convert from int to Long : I searched for this on forum bt I didn't get any definite answer on this. 
&lt;BR /&gt;And one more thing&amp;nbsp;can we create a lead functionality using the tMemorizedRow component in the similar way we are creating a lag function?&amp;nbsp; 
&lt;BR /&gt;tJavaFlex&amp;nbsp;Expression used : 
&lt;BR /&gt; 
&lt;FONT size="2"&gt;if(!DRUG_ID_tMemorizeRows_1.equals(DRUG_ID_tMemorizeRows_1)) &lt;BR /&gt;{&lt;BR /&gt;context.cnt=1;}&lt;BR /&gt;else &lt;BR /&gt;{&lt;BR /&gt;context.cnt=(TalendDate.diffDate(TalendDate.parseDate("MM/dd/yy", "RX_FILL_DATE_tMemorizeRows_1"),TalendDate.parseDate("MM/dd/yy","RX_FILL_DATE_tMemorizeRows_1"),"dd"));}&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT size="2"&gt;Thanks,&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT size="2"&gt;Anurag Rai&lt;/FONT&gt;</description>
    <pubDate>Thu, 24 Dec 2015 09:16:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-12-24T09:16:40Z</dc:date>
    <item>
      <title>calculate difference between two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277863#M53505</link>
      <description>hi,&lt;BR /&gt;I am very new to Talend s/w. I have to create a job that calculates the difference between two dates and store the result as 0 &amp;amp; 1 calculated column&lt;BR /&gt;e.g. lets say we have a date column&lt;BR /&gt;date:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; derived_Col&lt;BR /&gt;12/21/2015&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0(since it is the first date)&lt;BR /&gt;12/21/2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0(when calculate 12/21/2015-12/21/2014=0 so it is 0)&lt;BR /&gt;12/21/2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0(when calculate 12/21/2014-12/21/2013=0 so it is 0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;11/21/2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1(when calculate 12/21/2015-12/21/2014=1 so it is 1)&lt;BR /&gt;so I have to create a job that calculate the days difference and if the difference is greater than 365days than it should flag as 1 else 0.&lt;BR /&gt;Any urgent help on this will be highly appreciated.&lt;BR /&gt;Thanks in advance&lt;BR /&gt;Anurag Rai</description>
      <pubDate>Sat, 16 Nov 2024 10:53:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277863#M53505</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T10:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: calculate difference between two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277864#M53506</link>
      <description>Hi&lt;BR /&gt;I don't understand the logic here, use the current day minus the input data? If so, why it is '&lt;FONT size="2"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;when calculate 12/21/2014-12/21/2013=0 so it is 0&lt;/FONT&gt;&lt;/FONT&gt;' for the 3rd row? Can you please explain it?</description>
      <pubDate>Mon, 21 Dec 2015 08:23:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277864#M53506</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-21T08:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: calculate difference between two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277865#M53507</link>
      <description>hi shong, 
&lt;BR /&gt;In this requirement we have to calculate difference between two consecutive dates(CurrDate-PrevDate) and if the difference is more than 365 days than it should flag as 1 ELSE 0. 
&lt;BR /&gt;The column is sorted on dates 
&lt;BR /&gt;Hope this helps, if you feel something is missing kindly let me know. 
&lt;BR /&gt;And thanks for the input</description>
      <pubDate>Tue, 22 Dec 2015 09:23:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277865#M53507</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-22T09:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: calculate difference between two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277866#M53508</link>
      <description>Hi
&lt;BR /&gt;Take a look at the 
&lt;A href="https://help.talend.com/pages/viewpage.action?pageId=265112021" target="_blank" rel="nofollow noopener noreferrer"&gt;tMemorizedRow &lt;/A&gt;component, this component memorizes the recorded data so you can access them in the next rows. To calculate the difference between two dates, use the built-in function TalendDate.diffDate(Date date1, Date date2, String dateType), you can read the source code of this function by expanding 
&lt;B&gt;Repository&lt;/B&gt;--&amp;gt;
&lt;B&gt;Code&lt;/B&gt;--&amp;gt;
&lt;B&gt;Routines&lt;/B&gt;--&amp;gt;
&lt;B&gt;System&lt;/B&gt;--&amp;gt;
&lt;B&gt;TalendDate.&lt;/B&gt;
&lt;BR /&gt;Let me know if you have any troubles to get it works.</description>
      <pubDate>Wed, 23 Dec 2015 04:11:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277866#M53508</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-23T04:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: calculate difference between two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277867#M53509</link>
      <description>hi Shong, 
&lt;BR /&gt;Thanks for the reply. 
&lt;BR /&gt;I have implemented this already I used tJavaFlex&amp;nbsp;to write a conditional expression to calculate the difference of two dates and store the return value in cnt variable which is already defined as integer but I am keep on getting Type mismatch: cannot convert from int to Long : I searched for this on forum bt I didn't get any definite answer on this. 
&lt;BR /&gt;And one more thing&amp;nbsp;can we create a lead functionality using the tMemorizedRow component in the similar way we are creating a lag function?&amp;nbsp; 
&lt;BR /&gt;tJavaFlex&amp;nbsp;Expression used : 
&lt;BR /&gt; 
&lt;FONT size="2"&gt;if(!DRUG_ID_tMemorizeRows_1.equals(DRUG_ID_tMemorizeRows_1)) &lt;BR /&gt;{&lt;BR /&gt;context.cnt=1;}&lt;BR /&gt;else &lt;BR /&gt;{&lt;BR /&gt;context.cnt=(TalendDate.diffDate(TalendDate.parseDate("MM/dd/yy", "RX_FILL_DATE_tMemorizeRows_1"),TalendDate.parseDate("MM/dd/yy","RX_FILL_DATE_tMemorizeRows_1"),"dd"));}&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT size="2"&gt;Thanks,&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT size="2"&gt;Anurag Rai&lt;/FONT&gt;</description>
      <pubDate>Thu, 24 Dec 2015 09:16:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277867#M53509</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-24T09:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: calculate difference between two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277868#M53510</link>
      <description>Hi&lt;BR /&gt;The error occurs &amp;nbsp;on this line:&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;context.cnt=1;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;The data type of context.cnt variable is long, you can't assign an int value to it, the code should be changed to:&lt;BR /&gt;context.cnt=1l;</description>
      <pubDate>Fri, 25 Dec 2015 07:19:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/calculate-difference-between-two-dates/m-p/2277868#M53510</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-25T07:19:04Z</dc:date>
    </item>
  </channel>
</rss>

