what does this formula mean in crystal report

Hi, All:

Today when I was modifying a crystal report, i found a field is defined by the following code.



IsNull(GroupName ({cstSP_FCAdmissionsDailyReport_rpt_rk;1.StaffName}))
or (Sum ({cstSP_FCAdmissionsDailyReport_rpt_rk;1.NewLead}, cstSP_FCAdmissionsDailyReport_rpt_rk;1.StaffName}) = 0
  and Sum ({cstSP_FCAdmissionsDailyReport_rpt_rk;1.FollowUp}, {cstSP_FCAdmissionsDailyReport_rpt_rk;1.StaffName}) = 0)


This field is used to get the sum of new leads based on each admission rep (staff name). I don't know if this formula is right or not, but the result is not correct. Could you guys help me with this?  Thank you.
sum-of-new-lead-code.jpg
Jason YuAsked:
Who is Participating?
 
LinInDenverConnect With a Mentor Commented:
Ah, good point. I think that means my actually won't work.  I was thinking the formula was sitting in the detail section of the report, and I have a feeling it isn't.

It is checking to see if the sum of Followup by Staffname is 0. You must have a group in the report by Staffname.

What that means is Sum (Field, Group).

If you have a group called State and wanted to sum an amount on all the detail lines within each state, you would end up with something like

Sum({table.field},{table.state})

This formula would only work in the group header or group footer of the State Group.

If possible (with confidential data removed, if any), could you attach the RPT file with data saved? It would be easier to see what is actually being returned.
0
 
James0628Connect With a Mentor Commented:
In your screenshot, the formula is being used to suppress GH1, so it's not really being "used to get the sum of new leads".  It's just being used to determine which GH1 sections are visible.  I'm assuming that group 1 is on StaffName.

 The formula in your screenshot suppresses GH1 if StaffName is null, or if the total NewLead and FollowUp for the StaffName group is 0.


 When you say that "the result is not correct", what result are you talking about, and what's wrong with it?

 James
0
 
mlmccConnect With a Mentor Commented:
The formula only returns TRUE or FALSE.

If you are trying to calculate based on that then it needs to part of a test

mlmcc
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
LinInDenverConnect With a Mentor Commented:
You might need it to do something more like this:

IF
(
IsNull(GroupName ({cstSP_FCAdmissionsDailyReport_rpt_rk;1.StaffName}))
or (Sum ({cstSP_FCAdmissionsDailyReport_rpt_rk;1.NewLead}, cstSP_FCAdmissionsDailyReport_rpt_rk;1.StaffName}) = 0
  and Sum ({cstSP_FCAdmissionsDailyReport_rpt_rk;1.FollowUp}, {cstSP_FCAdmissionsDailyReport_rpt_rk;1.StaffName}) = 0)
) = TRUE
then 1 else 0

This would give you a 1 or 0 for each detail line that meets the criteria. You can then sum this to get total number of rows meeting the criteria.
0
 
Jason YuAuthor Commented:
Hi, thank you guys for advising.

I will try to use LinInDenver's suggestion and try to calcluate the total. My confusion is why the sum function has two parameters instead of one.

like this one:  Sum ({cstSP_FCAdmissionsDailyReport_rpt_rk;1.FollowUp}, {cstSP_FCAdmissionsDailyReport_rpt_rk;1.StaffName}) = 0

And it has = 0 behind it, I am quite confused.

thank you.
0
 
mlmccConnect With a Mentor Commented:
The sum is for a group rather than the full report.

The second field identifies the group to sum over.

The = 0 is a comparison.  It is testing if the sum for the group is 0.

What is it you want to do?

mlmcc
0
 
James0628Commented:
Lin,

 If you look at the screenshot with the first post, the formula is actually used as the suppression formula for GH1.  At least that's what's in the screenshot.  Of course the formula could be used in other places too, but, based on the screenshot, it's not being used to calculate anything, so it's really unclear what they're really after.  Which is why I asked in my first post what kind of result they were actually trying to get.

 James
0
 
LinInDenverCommented:
Thanks James - I was actually trying to address the part where the author has stated "This field is used to get the sum of new leads based on each admission rep (staff name)."  

I will wait for the author to make another comment and/or attach the report file.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.