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

subreport - how to exclude from the main report 1

Status
Not open for further replies.

codrutza

Technical User
Mar 31, 2002
357
IE
Hello

I’m working with CRXI on SQL Server
Please help me with this

I have a report and subreport and I link tA.f= tB.f

I obtain:

tA.f tB.f tB.f2

1210
1210 aaa
1210 bbb
1210 ccc
1211
1211 bbb
1211 bbb
1212
1212 aaaa
1213
1213 bbb

The report should look like this:

1210
1210 bbb
1210 ccc
1211
1211 bbb
1211 bbb
1213
1213 bbb

I excluded from subreport in record selection formula aaaa
and the report looks:

1210

1210 bbb
1210 ccc
1211
1211 bbb
1211 bbb
1212

1213
1213 bbb



Please help
 
Since you want tA.f to disappear when there is no desired tB.f2 value, why not eliminate the subreport, use an equal join to tB, and eliminate 'aaaa' in your record selection formula?

-LB
 
Because I have different selections for report and for subreport
 
If you are requiring matching values, then that shouldn't matter--you would just add the selection criteria for each table.

Anyway, otherwise, you would need to add a copy of the sub to a group header section_a, create a shared variable that tests for the presence of a value in the sub, and then reference that to suppress GH_b.

-LB
 
This is an excellent idea with 2 subreports.

Thank you very much, I hope this is working:

I have now a subreport s1 in GHa which has the shared variable.
I bring in the next section GHb the variable (which I initialize).
I put another subreport s2 inGHc which is a copy of s1 but without variable.
I suppress GHa and GHb
I do s2 suppress blank report and GHc suppress blank section.

(I don't know how to do tests for the variable?? It doesn't fill with anything when is not needed... I don't know how to explain, the subreport is empty-blank.)

I will try it when I go to work, I tried it at home for a db that I made from scratch.
 
I don't understand this:
"If you are requiring matching values, then that shouldn't matter--you would just add the selection criteria for each table.
 
In GH_a you would have the first subreport containing the shared variable. You should NOT suppress the GH_a section, but instead, suppress all sections within the subreport, format the subreport to remove borders and in the subreport tab, check "suppress blank subreport". Then in the section expert of the main report->GH_a->check "suppress blank section." This will make GH_a and the first sub disappear without suppressing the section or the subreport outright, which allows the shared variable to pass.

Then for GH_b, go into the section expert->suppress->x+2 and enter a formula that checks for the value of the shared variable, e.g., assuming the variable is a number:

whileprintingrecords;
shared numbervar x;
x = 0 //note no colon

You also should have a reset formula in GF#1:
whileprintingrecords;
shared numbervar x := 0;

GH_b should only contain your main report groupname, and GH_c would contain the subreport detail. This section should also be formatted to "suppress blank section".

-LB
 
Could I have, please, the explanation for this:

"If you are requiring matching values, then that shouldn't matter--you would just add the selection criteria for each table."

?

 
There's not really much to explain. If you only want records from tA that meet certain criteria and that match records in tB with certain criteria, then you could just use an equal join between the tables, and in the record selection formula, use something like:

{tA.date} in date(2009,1,1) to date(2009,12,31) and
{tB.date} in date(2008,1,1) to date(2008,12,31) and
{tB.F} <> 'aaaa'

...but probably I don't have the whole story, so just go with your subreport approach.

-LB
 
What if I have a group one level up?
That doesn't disappear either.
 
You would have to use the same method, adding another subreport at the group #1 level.

I am not convinced this is the best approach. Before doing this, I would try creating a new report linking the two tables directly and adding the appropriate selection criteria and just see whether you get the results you are hoping for that way.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top