techwriterAR
MIS
I need to calculate the number of days a person has been a member of a department to determine seniority. The data comes from an SQL2000 database and I am using Crystal Reports v8.5.
The fields include employee number, department, date_in, date_out. The date fields are datetime. The problem I am having is that some of the date_out fields are blank/null which means that the employee is still a member of that department and I will need to use the current date.
The following formula works when both datetime fields have entries:
datetimevar start:={DPT_MBRS.DATE_IN};
datetimevar end:={DPT_MBRS.DATE_OUT};
datediff('d',start,end);
I do not know how to write the formula to use the current datetime if the date_out field is blank/null.
I know that I can get what I want in SQL by using the following formula but I have not been able to reproduce this formula in Crystal.
Sum(datediff(day, date_in, ISNULL(date_out, getdate())))
All help will be greatly appreciated.
Thanks,
gjeffcoat
The fields include employee number, department, date_in, date_out. The date fields are datetime. The problem I am having is that some of the date_out fields are blank/null which means that the employee is still a member of that department and I will need to use the current date.
The following formula works when both datetime fields have entries:
datetimevar start:={DPT_MBRS.DATE_IN};
datetimevar end:={DPT_MBRS.DATE_OUT};
datediff('d',start,end);
I do not know how to write the formula to use the current datetime if the date_out field is blank/null.
I know that I can get what I want in SQL by using the following formula but I have not been able to reproduce this formula in Crystal.
Sum(datediff(day, date_in, ISNULL(date_out, getdate())))
All help will be greatly appreciated.
Thanks,
gjeffcoat