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

A couple of formula questions

Status
Not open for further replies.

Rosy1

Technical User
Aug 6, 2003
19
0
0
US
I have a report that am calculating the turnaround times. using the formula below I get the number of minutes I need for the report. However when the turnaround time is greater than 1 hour, instead of adding the 60 minutes from the hour to the remaining minutes, the 1hr is converted to 100 then the minutes are added. My turnaround time of 1hr 43 minutes became 143 minutes. Any suggestions on how to fix this.

datetimevar CDT:={URTJ_CBPhoneResult_View.CallbackDateODBC}+{URTJ_CBPhoneResult_View.CallbackTimeODBC};
datetimevar PDT:={URTJ_CBPhoneResult_View.PhoneDateODBC}+{URTJ_CBPhoneResult_View.PhoneTimeODBC};
numbervar callphone:=datediff("n",CDT,PDT);
if callphone <=30 then totext(callphone,0,"") else
if callphone >30 then
if callphone <=60 then totext(callphone,0,"")
else totext(int(callphone/60),0,"") & totext(remainder(callphone,60),0,"")

My second problem is once I have calculated the time I need to create two columns one that has all data <30 minutes and the other with all data >30 minutes. I wrote an "if then" statement and it works, but when I try to calculate the average it is using all of the values that returned a "0" from the "If then" statement and making my average turnaround time look very good, but not accurate. Any suggestions on this one?
Thanks... Rosy

 
you want ot convert to seconds, check my FAQ, it should help you resolve this:

faq767-3543

As for having 2 columns alongside each other that have unrelated data, that's a bit tricky as Crystal treats data as related, as opposed to something like Excel which just lets you paste in a column.

It nmight be done, but there'd be a fair amount of code involved, such as creating 2 massive strings or arrays for each data type and placing them alongside each other with the can grow option.

So the formula would have something like:

stringvar less30;
stringvar more30
if callphone <=30 then totext(callphone,0,"") else
if callphone >30 then
less30:=less30+totext(callphone,0,"")+chr(13)
else if callphone <=60 then
more30:=more30+totext(callphone,0,"") +chr(13)
else
<not sure what you want here, you said two columns but the following is a third data type:
totext(int(callphone/60),0,"") & totext(remainder(callphone,60),0,"")

Anyway, you get the idea.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top