[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# Problem using a shared variable in a formula that is summerised later.

Posted on 2012-08-29
Medium Priority
813 Views
Good Afternoon Experts,

I have a report that uses Paramater Fields to determine a range of dates to run for closed loans and then calculates total commissions paid to sales people for those loans.  I have set up several formulas to determine the commission per loan, per loan officer as many have different deals than others.  I then use a summery in the report footer to give a grand total for each salesman.  This has all been working fine for some time now, but recently a new salesman has come in who's deal involves the total of all loans closed Year to Date rather than to total closed within the commission period as all others are.  Because the selection criteria of the report will allways be a 30 day period of time I inserted a sub report that runs the sales Year to Date and use a shared variable to access the total year to date, that works fine as well.  The problem comes when I try to use that information.  I calculate the amount paid to each individual using a formula that multiplys the loan amount by a factor that changes based on certain criteria for each sales man, for example one salesmans factor is calculated as follows:

if {custom_lo_commission_.OverRidePlan} = "A" then 10.00
Else if {custom_lo_commission_.OverRidePlan} in ["B", "C", "D", "E", "F"] then 5.00
Else if {custom_lo_commission_.OverRidePlan} = "G" then 3.50
Else if {custom_lo_commission_.OverRidePlan} in ["H", "I"] then 3.00
Else if {custom_lo_commission_.OverRidePlan} = "J" then 2.50
Else if {custom_lo_commission_.OverRidePlan} in ["K", "L", "M", "N", "O"] then 2.00
Else 1.00

This works fine, then I use this formula to determin the actual dollar figure per loan:

{@LoanAmount} * ({@Brown} / 10000)

This also works fine, then I insert a sum of the @Brown formula in the report footer and all is well.

However on this new salesman I built a formula to determine the factor that depends on the value of the shared variable from the sub report, it follows:
first I declaire the shared variable in the header.
//@IntitVars
Shared Numbervar TotalLoans;

Then in the details I have a formula to pull the value of the shared variable;

WhilePrintingRecords;
Shared NumberVar TotalLoans;
TotalLoans

then I use that formula in my formula to determine the factor for the salesman:

if {@YTDClosedLoans} < 100000000 Then 3.00
else 1.00

This works as well, I get the correct factor but then when I preview the report the summery of the formula that uses the factor to calculate a dollar figure throws this error:

"A summary has been specified on a non-recurring field.
Details: @Kelly\$"

Any ideas?
0
Question by:ISBTECH
• 2
• 2

LVL 101

Expert Comment

ID: 38346618
What is the @Kelly\$ formula?

mlmcc
0

Author Comment

ID: 38346673
sorry:
@Kelly
if {@YTDClosedLoans} < 100000000 Then 3.00
else 1.00

@Kelly\$
{@LoanAmount} * ({@Kelly} / 10000)

Then I insert a summery of @Kelly\$ in the report footer, it the summery that throws the error.
0

LVL 101

Accepted Solution

mlmcc earned 2000 total points
ID: 38346978
The problem is Crystal uses a multiple pass method to build the report.

Summary functions are evaluated in the first pass through the report but shared variables and subreports are evaluated in the last pass through the report thus the values aren't available when the summary is evaluated.

You will need to do a manual summary of that formula.

mlmcc
0

Author Closing Comment

ID: 38347023
That is what I was beginning to think.  Thanks!
0

## Featured Post

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview
###### Suggested Courses
Course of the Month20 days, 11 hours left to enroll