Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Production Issue - I need help fast with a datevar issue

Status
Not open for further replies.

agray123

Technical User
Mar 4, 2002
110
US
I have a number of reports utilizing the following formula to populate "Next Review Date" from a system that sets "review Date" as one year from hire date - this stinks so I had to create this:
datevar review:={HR_NEW_DIVISION.REVIEW_DT} ;
datevar revadj;
datevar cdadj;
datevar out;

revadj:=date(year(today),month(review),1);
cdadj:=date(year(currentdate),month(currentdate),1);

if review > currentdate then out:=review else
If revadj < cdadj then
out:=date(year(currentdate)+1,month(review),day(review)) else
out:=date(year(currentdate),month(review),day(review));
out

To fix it - it pushes the date into the proper year - If my review was in April - next review is 4-2005 - if it is in July then 7-2004 will stay.

My new problem is that some records are starting to show up without review dates - how can I change this to first look at review date - and if it is blank use hire date?

 
Try changing review to:

datevar review := if isnull({HR_NEW_DIVISION.REVIEW_DT}) or
{HR_NEW_DIVISION.REVIEW_DT} = date(0,0,0) then {table.hiredate} else {HR_NEW_DIVISION.REVIEW_DT};

-LB
 
GOT IT - thanks

I created another formula
if {HR_NEW_DIVISION.REVIEW_DT}<{HR_NEW_DIVISION.HIRE_DT}
then{HR_NEW_DIVISION.HIRE_DT}
else {HR_NEW_DIVISION.REVIEW_DT}

and run the datevar off of it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top