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!

Suppress detail if subreport has no rows

Status
Not open for further replies.

resdevlabs

Programmer
Jun 11, 2003
26
US
I have two details sections - a & b. Details b has a subreport. I wish to suppress details a if the subreport has no rows. How can I accomplish this?
 
You can't, as Details A fires before Details B.

Can you reverse them?

The alternative is to insert yet another section, place the subreport in Details A, return a shared variable for use by Details B to use in a suppression formula, and then use a suppression formula in Details C to suppress it if there aren't any rows, otherwise fire it again...

You may be better served to describe the tables, environment, example data and expected output as there may be a better way to handle this.

-k
 
I've created a rollup report to summarize work order data.

WorkOrder Table:
WO#
SubjectID

Subject Table:
SubjectID
SubjectDesc
Parent

There are 3 levels of subjects.
SubjectID SubjectDesc Parent
------------ ------------- -------------
1417 ACC_REQUEST null
1418 ACC_JDE 1417
1510 ACC_JDE_PWD 1418
1511 ACC_JDE_ERR 1418
1419 ACC_PEO 1417
1512 ACC_PEO_PWD 1419
1513 ACC_PEO_ERR 1419

I created the main report to list all subjects where the parent = 1417. The subreport lists all work orders where the subject is in the lowest level (that is I joined the reports on subjectid = parentid).

This gives me exactly what I want, except for the 2 level subjects printing even when there are no rows in the subreport.

 
Instead of using a subreport, have you considered using the subject table twice and then doing the join in in the mainreport.

When you try to add the subject table again Crystal will prompt for an alias name or you can use the default. Then just link in the normal way, depending on what you are trying to do you may need to use a left outer join between the subject and subject_1 alias.

You can then put conditions on the report to handle nulls.

Ian Waterman
UK Crystal Reports Consultant.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top