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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula Question 1

Status
Not open for further replies.

metalteck

MIS
May 10, 2006
54
US
I currently have a database that calculates the Beg and End Date for the time it took an order to be ordered. I'm using Crystal 8.5. I'm trying to find out how long it took for the order to be taken, but am having a hard time doing it. Can someone please help me.

Thank you

The formula for the Begin Date is:
{BADPLPP.LPADT1}&"/"&{BADPLPP.LPADT2}&"/0"&{BADPLPP.LPADT3}

The formula for the End Date is:
stringvar MyDate := totext({badplpp.lpldd},0,"");
if len(MyDate) = 5
then
cdate(2000+val(right(MyDate,2)), val(left(MyDate,1)),val(mid(MyDate,2,2)))
else
if len(MyDate) = 6
then
cdate(2000+val(right(MyDate,2)), val(left(MyDate,2)),val(mid(MyDate,3,2)))
 
You need to convert the first formula to a date datatype. If you need help doing this, you should show samples of what each field returns and identify their current datatype.

-LB
 
The Begin Date returns as a number and returns a result of:
1/14/6

The End Date returns as a date and a result as of:1/14/2006.

To make it even more specific, the majority of the calculations will be between the days and possibly the months.

Can you show me how to convert this, thank you.
 
I don't believe that your begin formula would return as a number when it includes string elements. I was asking about how the individual fields contributing to that formula appeared, and what the datatypes are. If they are numbers, and I guess you mean the formula is set up for M/d/y, then change your {@begin} formula to:

cdate(totext({BADPLPP.LPADT1},"00")+"/"+
totext({BADPLPP.LPADT2},"00")+"/"+
totext(2000+{BADPLPP.LPADT3},"0000"))

Then you can use a datediff formula like:

datediff("d",{@Begin},{@End})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top