Joined: 02 Mar 2011
Online Status: Offline
Posts: 2
Topic: Cannot Summarized the formula field Posted: 02 Mar 2011 at 10:48pm
I am newbie for Crystal Report and I was encountered some problem to display a record that I want. There is the scenario:-
I got 3 level of report
1. Main Report
2. Sub-Report
3. Details
There is a formula field in sub-report that count a duration for activity:
@Actual Duration
------------------
Local numberVar durationSecond := DateDiff ("s", {dataSource.Start_Date_and_TimeActivity Execution9}, {@Max End Date});
Local numberVar iSecond := durationSecond mod 60;
Local numberVar iHour := durationSecond \ 60;
Local numberVar iMinutes := iHour mod 60;
iHour := iHour \ 60;
ToText(iHour, "00", 0) & ":" & ToText(iMinutes, "00", 0) & ":" & ToText(iSecond, "00", 0);
Example:
Name Start Time End Time Actual Duration
Activity A 10:00AM 11:30AM 1:30:00
Activity B 10:00AM 11:50AM 1:50:00
Activity C 10:00AM 11:55AM 1:55:00
So, now I would like to total up the actual duration for these three
activity (total = 5:15:00) and display it in Main report. But, it prompt
the error message: "This field cannot be summarized"
Joined: 22 May 2009
Online Status: Offline
Posts: 347
Posted: 03 Mar 2011 at 2:06am
The result of the formula is a text string and therefore cannot be summarized. Create a Global numbervar that works alongside the local:
Global numbervar totalDurationSecond:=totalDurationSecond + DateDiff("s",{dataSource.Start_Date_and_TimeActivity Execution9}, {Max End Date});
Then create another formula for when you want to display the total using the second,hour, and minute calculations and totext string from your original formula.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum