Link to home
Start Free TrialLog in
Avatar of Idratherbegolfing
Idratherbegolfing

asked on

Cannot Rank or Group By Second-Pass Formula Results in Crystal Reports

I am attempting to build a report that pulls the 10 highest valued results from a second-pass formula.  The formula I want to pull the top 10 from is the result of a subtraction of 2 second pass formulas:
"{@PrintITGNAV}-{@PrintNoITGNAVs}"
These are basically SUMs using the 3 formula methodology in the second pass.

Can I do this, and if so how?
Avatar of Mike McCracken
Mike McCracken

You can but it requires using a subreport.

Does the report have a subreport?
If so you can't do it.

mlmcc
Avatar of Idratherbegolfing

ASKER

Thanks!  I don't currently have a sub-report, but I could certainly build one and insert it into this report.  I did some research on this topic online before I wrote this post and found in several places that people suggested using a subreport.  Unfortunately none of them really talked in detail about how to do this.  I've tried several ways I thought it could be done with a subreport, but haven't had any success.  Could you point me in the right direction?  Thanks again!
Check this aritcle.  It shows a method of passing arrays into a subreport to do what you want.  You would have to modify it to fit your needs.

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40e7130d-aa1e-2b10-ce9f-eee2a54ff4cd

mlmcc
Thanks.  I'll give this a try and let you know how it works!
I still can't seem to get this to work as the field I need to sum "Cannot Be Summarized" in the first summary formula that you insert into the report footer (its a second pass formula result):

//This formula uses Crystal syntax.
WhilePrintingRecords;
Shared CurrencyVar curCounter;
Shared CurrencyVar curTotal;
curCounter := curCounter + {Customer.Last Year's Sales};
curTotal := (curCounter/Sum ({Customer.Last Year's Sales}))*100;
ToNumber(curTotal);

While playing around with this, I think I got everything else to work using a formula that can be summarized (but won't give me the data I need) except for the fact that my subreport only pulls the first "ShowValue" number wherever I insert it into the report, which seems odd.  

Basically I have a table that has 3 fields I use for this report.  Product, Price, and Price Type.  I have 2 Price Types that I want to analyze the differences on so I've built formulas to calculate the difference between PriceType1 and PriceType2 for each Product.  Then I want to show only the top 10 results (in descending order) from this difference calculation.

So maybe I'm taking the wrong approach by using the 3 formula method to calculate this difference?

Anyone have any ideas?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's a great idea.  I'll give that a shot and see how that works.  Thanks again!
This worked.  I added a second instance of the table and was able to get all my data into one record so as not to have to use second pass formulas.  Without using the second pass formulas I was easily able to do some topN groups to pull my top 10 price differences.  Thanks!