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

Passing Subreport Results Back To The Main Report

Status
Not open for further replies.

crystalreport85

Programmer
Sep 27, 2010
51
CA
how to get info from the subreport that onthe last record it should set a variable and pass to the main report . how to do it
 
Your posts are not providing enough information to allow a reader to respond. Please spend some time describing what you are trying to do and explaining the report structure. And, please--use complete sentences.

-LB
 
It appears English is not your first language, so please try your best, but do not worry too much about using perfect English.

Try to supply a a description as Lbass requested but do not worry if you make mistakes in English
 
I am sorry ..I was in a hurry..I pressed submit btn.
here
I have fields
bin# ---which is from the database and print seq#.
I have to pick item# from diff database--where i use subreport.
item# is always less then the the bin# so Just bin# is displayed without the item# Like following
bin# Item#
1 aa
2 bb
3 cc
4
5
6

My question:
I do not want to display the bin where item is empty.

--I tried using shared var(as 0) declare it in reportheader in main report
--and reset the value to 9999 in detail section in subreport.
--trying to display it in detail section in main report returning zero.

I tried putting the copy of the subreport in the report header.
Result: first record returns 0 and adds one extra rec with the shared value 9999 where item# is null
bin# item# sharedvar
1 aa 0
2 bb 9999
3 cc 9999
4 9999

Where am I doing wrong?


 
Right now you have the subreport in the same section as the item #, correct? Can't tell if it is a group or detail section, but anyway let's say it is in a group header section for a group based on item #, and that the sub is linked to the main report on the item#. Insert another group header, and place the subreport in the GHa section. Leave the main report fields in GHb You can format the GHa to "underlay following sections" so that it aligns with the item #.

In the subreport, create a formula like this:

whileprintingrecords;
shared stringvar item := {table.item#};

Place this in the subreport group footer.

In the main report report header and group footer, place a reset formula:

whileprintingrecords;
shared stringvar item := "";

Then go into the section expert of the main report->GH_b->suppress->x+2 and enter:

whileprintingrecords;
shared stringvar item;
item = ""; //note no colon

-LB
 
Thank you for the quick reply.
subreport in the same section(detail section) as the bin# from one database.

I am not using group in both report.
I think it good to check the db.item# then declaring a Fcounter..
--shouldn't put the subreport above the detail section in this case ..
 
Put the subreport in detail_a and the other fields in detail_b. You can then use the shared variable as suggested. You can add a detail c (suppressed) that contains the reset formula. In the section expert, you can format detail_a to "underlay following sections" so that the sub aligns. Then follow the earlier step for suppression of detail_b if the shared variable = "".

-LB
 
Still my record is printing like following

bin# item# sharedvar
1 aa
2 bb aa
3 cc bb
4 cc
5 cc
6 cc

Thank you
 
The subreport MUST be in the detail_a section, with the main report fields in the detail_b section.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top