Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sum Allowed in Chart but not as Formula Post Reply Post New Topic
Author Message
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Topic: Sum Allowed in Chart but not as Formula
     Posted: 11 Feb 2010 at 12:52pm
Just as the Subject title says. I'm creating a report and I want to sumarize a number field that is based of the formula {Break}:
 
if {ReasonCode}='Break'  
then cdbl({TotalMinutes})
        else 0
 
 
{TotalMinutes} is a formula that is:
 
if {LogIn}>{LogOut}
then datediff('n', {LogOut}, {LogIn})
         else 0
 
 
{LogOut} is a DateTime field and {LogIn} is a formula based on the same DateTime field:
 
if next{ResourceName}={ResourceName}
and date(next({DateTimeField}))=date({DateTimeField})
then next({DateTimeField})
else date(0,0,0)
 
 
 
I can pull {Break} into a chart as Show Value with the Summary Operation of SUM and it displays exactly what I want. But Crystal will not allow me to summarize the formula field in a formula, using the SUM function or as a Running Total.
 
Can someone explain to me why?
 
Thanks.


Edited by FrnhtGLI - 11 Feb 2010 at 12:56pm
IP IP Logged
mfrank
Newbie
Newbie
Avatar

Joined: 10 Nov 2008
Location: United States
Online Status: Offline
Posts: 12
Quote mfrank Replybullet Posted: 25 Feb 2010 at 8:16am
Did you ever find a solution to this problem?
 
I am having this exact problem with the formula below.
 
If     ( (
         {HPD_Search_Assignment_Logs.Assigned_Group_2}={?Pm-@Group Name} and
         {HPD_Search_Assignment_Logs.Assigned_Group}<>{?Pm-@Group Name} and
         {HPD_Search_Assignment_Logs.Incident_Number}<>Next({HPD_Search_Assignment_Logs.Incident_Number})and
         {HPD_Search_Assignment_Logs.Submit_Date2}>={@Begin Week 1} and
         {HPD_Search_Assignment_Logs.Submit_Date2}<={@End Week 1}
        )
    or
        (
        {HPD_Search_Assignment_Logs.Assigned_Group_2}={?Pm-@Group Name} and
        Next({HPD_Search_Assignment_Logs.Assigned_Group_2})<>{?Pm-@Group Name} and
        {HPD_Search_Assignment_Logs.Incident_Number}=Next({HPD_Search_Assignment_Logs.Incident_Number}) and
        {HPD_Search_Assignment_Logs.Submit_Date2}>={@Begin Week 1} and
        {HPD_Search_Assignment_Logs.Submit_Date2}<={@End Week 1}
        )
      ) 
    then 1
    else 0
Me
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 25 Feb 2010 at 8:22am
No. I ended up having to get the datediff by seconds, add the like ones together through various running totals, convert seconds to days, hours, minutes and seconds, create calculations to convert those into minutes, and create my own legend by taking a screenshot of the left side of the legend (colors and titles), and adding each calculated field to a text box so that it looks like the true legend.
 
PITA as it was. It is working.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Feb 2010 at 9:07am
I acnnot answer the question as to why it works in the chart but it will not work in a formula because you are using a NEXT() function in your original formula. It has to do with when Crystal reads the data in passes.
Instead of Using this formula for a 1 or 0 use it as an evaluate formula in a Running Total.
IP IP Logged
mfrank
Newbie
Newbie
Avatar

Joined: 10 Nov 2008
Location: United States
Online Status: Offline
Posts: 12
Quote mfrank Replybullet Posted: 25 Feb 2010 at 1:55pm

The running total worked.  Thank you very much.

Me
IP IP Logged
mfrank
Newbie
Newbie
Avatar

Joined: 10 Nov 2008
Location: United States
Online Status: Offline
Posts: 12
Quote mfrank Replybullet Posted: 25 Feb 2010 at 1:57pm
The running total worked beautifully.  Thank you so much for your help.
Me
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