Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal Reports formula result not displaying in report
Message
General information
Forum:
Visual FoxPro
Category:
Third party products
Title:
Crystal Reports formula result not displaying in report
Miscellaneous
Thread ID:
00417049
Message ID:
00417049
Views:
63
I am new at this Crystal Reports formula stuff so I am not sure what's wrong. What I'm doing is subtract one time from another time and trying to display the time difference between the two times. The times are both in text format (00:00:00). So I convert them to seconds from text. My final answer should also look like (00:00:00). Where I take the seconds (in numeric format) and put them back into text. I can't get the result called timeint to appear on my detail lines of my report next to the before and after times. Any ideas?

Also, is there a shorter way in Crystal to do this? I bet there is.

Here is the formula:
NumberVar th:=0;
NumberVar tm:=0;
NumberVar ts:=0;
NumberVar t_tot:=0;
NumberVar t1:=0;
NumberVar t2:=0;
NumberVar t3:=0;
StringVar tot1 :="";
StringVar tot2 :="";
StringVar tot3 :="";
StringVar timeint:="";

IF  {scaarrest.FDFSH_TIME}<>"" AND  {scamaster.FDSTPTIMEA}<> "" 
THEN
tm=60*Val (Mid ({scaarrest.FDFSH_TIME},4 ,2 )) - Val (Mid ({scamaster.FDSTPTIMEA},4 ,2 ));
th=3600*Val (Mid ({scaarrest.FDFSH_TIME},1 ,2 )) - Val (Mid ({scamaster.FDSTPTIMEA},1 ,2 ));
ts=Val (Mid ({scaarrest.FDFSH_TIME},7 ,2 )) - Val (Mid ({scamaster.FDSTPTIMEA},7 ,2 ));
t_tot=th+tm+ts;
IF t_tot<0
THEN
tm=60*Val (Mid ({scamaster.FDSTPTIMEA},4 ,2 )) - Val (Mid ({scaarrest.FDFSH_TIME},4 ,2 ));
th=3600*Val (Mid ({scamaster.FDSTPTIMEA},1 ,2 )) - Val (Mid ({scaarrest.FDFSH_TIME},1 ,2 ));
ts=Val (Mid ({scamaster.FDSTPTIMEA},7 ,2 )) - Val (Mid ({scaarrest.FDFSH_TIME},7 ,2 ));
t_tot=th+tm+ts;
t1=Abs (t_tot/3600);
t_tot=t_tot-(t1*3600);
t2=Abs (t_tot/60);
t_tot=t_tot-(t2*60);
t3=t_tot;
tot1=ToText (t1);
tot2=ToText (t2);
tot3=ToText (t3);
timeint=tot1+":"+tot2+":"+tot3;
timeint
Thanks for the help.
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Next
Reply
Map
View

Click here to load this message in the networking platform