In Crystal Reports we have a formula that gives us hh:mm from a datetime field. We need to now get a summary off this formula in the group footer. However crystal does not allow us to do that natively when right clicking the formula. I have attempted to convert that formula to a number but it throws an error on everything I try. For instance tonumber or totext it will tell me it expects a date field, then it will tell me it expects a time field. All I am after would be a summary to add the hours and minutes for the group it is in.
Hi Jeff,
1. Create a formula called @Itr with this code and place it on the Details:
EvaluateAfter({@DateDiff}); shared numbervar fin_t; If {@DateDiff} >= time(00,00,00) or {@DateDiff} <= time(00,00,00) then ( local timevar t := time({time_field}); fin_t := fin_t + (hour(t)*3600) + (minute(t)*60) + second(t); )
2. Create a formula called @Display with this code and place it on the Group Footer:
shared numbervar fin_t; NumberVar Hours := Truncate (fin_t/3600); NumberVar Minutes := Truncate (Remainder (fin_t,3600)/60); Totext (Hours,0,"") + ':'+ Totext (Minutes,0,"")
3. Create a formula called @Reset and place this on the Group Header #1:
shared numbervar fin_t := 0;
-Abhilash
Thank you, that works.