Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Cannot Summarized the formula field Post Reply Post New Topic
Author Message
lawrencelowsy
Newbie
Newbie


Joined: 02 Mar 2011
Online Status: Offline
Posts: 2
Quote lawrencelowsy Replybullet 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"

Any idea?

Thank you.....
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet 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.
|< /\ '][' ( )
IP IP Logged
lawrencelowsy
Newbie
Newbie


Joined: 02 Mar 2011
Online Status: Offline
Posts: 2
Quote lawrencelowsy Replybullet Posted: 03 Mar 2011 at 7:46pm
Thank for the help!!

But how to total up the duration? I am using SUM, but the error still appear.

@Total_Duration
---------------------------------
SUM {(@Actual Duration)}



Thanks again.
IP IP Logged
Printable version Printable version

Forum Jump
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