?
Solved

what does this formula mean in crystal report

Posted on 2012-09-19
9
Medium Priority
?
613 Views
Last Modified: 2012-10-08
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
0
Comment
Question by:Jason Yu
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 35

Assisted Solution

by:James0628
James0628 earned 400 total points
ID: 38417229
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
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 800 total points
ID: 38419730
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
 
LVL 14

Assisted Solution

by:LinInDenver
LinInDenver earned 800 total points
ID: 38419763
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 

Author Comment

by:Jason Yu
ID: 38420275
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
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 800 total points
ID: 38420303
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
 
LVL 14

Accepted Solution

by:
LinInDenver earned 800 total points
ID: 38420305
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
 
LVL 35

Expert Comment

by:James0628
ID: 38420973
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
 
LVL 14

Expert Comment

by:LinInDenver
ID: 38422674
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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question