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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drilling to bottom level

Status
Not open for further replies.

PositiveParrot

Technical User
Apr 16, 2004
19
GB
Crystal reports version 7

We have a business hierarchy with different numbers of levels depending on which leg you go down e.g.

Company - Dept1 - Section 1
Section 2 - Team 1
Team 2
- Dept2
- Dept3

We have crystal reports with groups set up for each possible level and then the details are shown after the last group.

We would like it to be so that if the user went down the leg 'Dept2' for example and drilled they could get to the details straight away instead of drilling through the other groups that don't exist in this part of the hierarchy.

Any help would be much appreciated. Hope I've explained it OK.

Regards,

PP

 
I'm not sure what features are available in v.7.0, but if you have the option of using on-demand subreports as in v.8.0, the following should work.

Set up your main report with your three groups, with GH#2, GH#3, and the details section formatted with "Hide (drill-down OK)". Insert another GH#1 section. Place the Group #1 group name in GH#1a and insert a subreport into GH#1b, selecting "On-demand subreport".

Create the subreport exactly like the main report, except do not hide the group header or details sections. Using the section expert, format GH#2 and GH#3 with "Suppress blank section".

Place the subreport in the main report's GH#1b, linking the subreport to the main report on the group #1 field. Right click on the subreport->format subreport->subreport and choose "on-demand subreport caption"->x+2 and enter:

totext({table.grp1field},0,"")

If the group 1 field is already a string, remove the totext(,0,""). Then go to the font tab and change the color to black and remove the underline, so that the hyperlink appears the same as the other main report GH#1a group name field.

Finally, in the main report section expert (format->section) select GH#1a->suppress->x+2 and enter something like:

(distinctcount({table.grp2field}, {table.grp1field}) = 1 and
distinctcount({table.grp3field},{table.grp1field}) = 1) or
sum({@isnull}, {table.grp1field}) = 0

//where {@isnull} is:

if isnull({table.grp2field}) or
isnull({table.grp3field}) then 0 else 1

Then select GH#1b->suppress->x+2 and enter:

distinctcount({table.grp2field}, {table.grp1field}) > 1 or
distinctcount({table.grp3field}, {table.grp1field}) > 1

You might need to adjust the suppression formulas depending upon when you want to see all drilldown sections at once.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top