Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ranking Report with 2 groups

Status
Not open for further replies.

cvgalloway

Technical User
Jul 8, 2008
14
US
I have a Two Year Customer Sales History Report. It is grouped by 1) Salesrep 2) Customer
I have ranked the sales dollar for the most recent year in the report.
I want to show the customer's rank from the previous year on this report.

This is what I've done:


1. Create your customer sales report for current year as the main report, group by customer and sort by topN.

- show rank using the groupnumber
- put your resulting data (e.g., cust id, total sales, rank)in the Group Header section of the main report
- no data in detail section

2. Now create the same customer sales report for previous year as a subreport, group by customer and sort by topN.

- show rank by using groupnumber
- put the resulting data of this report (e.g., total sales, rank
- don't need to duplicate the id)
in the Group Header of the subreport
- no data in detail section

3. In the main report, add a Group Header b section below the existing group header, which now becomes Group Header a.

4. Put the subreport in the Group Header b section without linking it to the main report group

5. In the main report, create a shared variable called "cust"

whileprintingrecords;
shared numbervar cust := {table.customer};
[this field would probably be your
customer id field from the invoice hdr]

6. Put this shared variable in Group Header a section

7. Also put this shared variable in the Group Header of the subreport.

8. Within the subreport, go to section expert, select Group Header > Suppress > X+2 button and enter

whileprintingrecords;
shared numbervar cust;
{table.customer} <> cust

- this will suppress all customer data except for the data matching the customer in
Group Header a in the main report

9. In the main report, go to section expert, select Group Header a and format to "Underlay following section".

- this will slide GH a and b together
- you will probably need to move the subreport around a bit and
format it so the data doesn't overlap and so it lines up
- put your data headers in the main report Page Header section


But, it is not working correctly - it is not suppressing.
What have I done wrong?

Thanks for your help!!
Catherine
 
I'm not clear what you're after, but it occurred to me you could maybe get something like it using Crosstabs. That would at least allow you to show the same data in more than one grouping without the need for subreports.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
This looks like a suggestion from me. Please show the content of the formulas you used for the shared variables in the main and subreports and explain where you put them.

-LB
 
I'm confused about what you are asking.
In the main report my shared variable formula is:
whileprintingrecords;
shared numbervar cust := {p21_view_invoice_hdr.customer_id_number};

This formula is located in GH1a

In the subreport my shared variable formula is the same formula and it is located in GH1

Group 1 is grouped on my customers

Then in the subreport in the section expert for the GH1 - I have the suppress formula of:
whileprintingrecords;
shared numbervar cust;
{p21_view_invoice_hdr.customer_id_number} <> cust


Thanks - Catherine
 
Don't place the formula in the subreport at all. Just reference the variable using your current formula in the section expert. I.e., just try removing the formula you have placed in the GH1 of the subreport. This should work if the sub is placed in GH1b of the main report.

-LB
 
Perfect that works!!!
Thanks so much, I was getting ready to pay a consult to fix the report for me!!

Catherine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top