Start and End Date Difference Less than One Year
<p>Hello,</p>
<p> </p>
<p>I have a report that I am working on for a customer for Lease Management. They have a request for a field called "Lease Term Less Than 1 Year". This field should look at the Start Date and End Date of the lease, and if it is less than 1 year difference, return a YES, otherwise return a NO. I set the following up and thought it was working, but I was mistaken.</p>
<p> </p>
<div>if(BirtDateTime.diffMonth(dataSetRow["T1_RESTARTTODATECONV"],</div>
<div>dataSetRow["T1_REEXPTODATECONV"]) < 12) </div>
<div>{</div>
<div>"Yes"</div>
<div>}</div>
<div>else</div>
<div>{</div>
<div> "No"</div>
<div>}</div>
<div> </div>
<div> </div>
<div>dataSetRow is my end date.</div>
<div> </div>
<div>This will work unless you have a scenario where the difference comes down to days within the 12th month, for instance, if I have a start date of 06/01/2015 and an end date of 06/02/2015, the expression is still returning a yes. I tried setting thi sup using years instead of months, but that also did not work. I thought about using days, but that will present problems with leap years. Any advise? My data set is a SQL query, so it may also be possible to either break the dates down further within the query, or do all of the calculation within the query, but I could not figure that out either.</div>
<div> </div>
<div>I am writing this report using Eclipse Version 3.6.2</div>
<p> </p>
<p>I have a report that I am working on for a customer for Lease Management. They have a request for a field called "Lease Term Less Than 1 Year". This field should look at the Start Date and End Date of the lease, and if it is less than 1 year difference, return a YES, otherwise return a NO. I set the following up and thought it was working, but I was mistaken.</p>
<p> </p>
<div>if(BirtDateTime.diffMonth(dataSetRow["T1_RESTARTTODATECONV"],</div>
<div>dataSetRow["T1_REEXPTODATECONV"]) < 12) </div>
<div>{</div>
<div>"Yes"</div>
<div>}</div>
<div>else</div>
<div>{</div>
<div> "No"</div>
<div>}</div>
<div> </div>
<div> </div>
<div>dataSetRow is my end date.</div>
<div> </div>
<div>This will work unless you have a scenario where the difference comes down to days within the 12th month, for instance, if I have a start date of 06/01/2015 and an end date of 06/02/2015, the expression is still returning a yes. I tried setting thi sup using years instead of months, but that also did not work. I thought about using days, but that will present problems with leap years. Any advise? My data set is a SQL query, so it may also be possible to either break the dates down further within the query, or do all of the calculation within the query, but I could not figure that out either.</div>
<div> </div>
<div>I am writing this report using Eclipse Version 3.6.2</div>
0
Comments
-
<p>Hi Brent,</p>
<p> </p>
<p>very strange the fact that <span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;"> </span><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">06/01/2015 and 06/02/2015 give you more then 12 months difference.</span></p>
<p> </p>
<p>I have tested it mon my side with BIRT 2.3.2 and 3.7.2 (I don't have your version installed) and itr works perfectly.</p>
<p> </p>
<p>Can you uload a small flat file/data set with the date you want to test.</p>Warning No formatter is installed for the format ipb0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 106 General Questions
- 145 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management