crystal report help
i am developing a windows application, my database is in MS-Access. I have made a crystal report which is showing product name, activation date, expiry date and days left columns. I want to add one more formula field which will show the status like Running and Expired. If the days are left then it will show running and if the days are not left then it will show expired in that column.
I have made a formula field Days Left, which is showing the days left for the expiry, its working fine but now i want that it will also show the negative days. Like if the product gets expired then the days left field will show the negative dates and the status field will display the status as expired . The code what i have written for formula field days left is:
DateDiff ("d", {tblwarranty.warrantyExpiry} , CurrentDate )
Please help me out with the solution. Please give the code also.
naura paxPosted Nov 4, 2009, 5:42 AM
I think this function datediff("d",{tblWarranty.ExpiryDate},CurrentDate) is wrong for your requirement the order should be datediff("d",CurrentDate,{tblWarranty.ExpiryDate}) instead, because second argument is startdate & third one is enddate it will show days left from today.
you can add another formula field in which you can write logic based on the value of above formulafield :
If ({ReportName.daysLeft}>0}
"Running"
else
"Expired"
and use this formula field as another column in your report.