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!

variable come from subreport is not matched to the item in main report 1

Status
Not open for further replies.

francesguan

Technical User
Jan 26, 2006
52
CA
Dear all,

I once create shared variable in subreport and used in main report. but today I have spent hours and still can not figure out why the result I got in main report is not matched to subreport. the following is how I did:

in subreport,

whileprintingrecords;
shared numbervar OpenOrder:=Sum ({@QtyOpen})

I placed it in the group footer; group name is item.item;

in Mainreport,

whileprintingrecords;
shared numbervar OpenOrder;
"get" & OpenOrder & "from subreport"

I put this on group header#1, the same place as subreport I put, so I can compare the the difference.

the link between the main report and sub report is item.item=item.item



the result is this variable do show up in main report, but not matched to the correct item.
I tried to attach a screen copy here, but not find how.


Thanks a lot in advance in any comments,

Frances





 
The shared variable in the main report has to be placed in a section below the one in which the subreport is executing. Insert a GH#1b and place the formula there.

-LB
 
Hi, thanks, LB.
it seems I got some progress, but not enough.

in main report, I moved the following variable to GF#1 which is a section below the subreport, the result is when subreport has number, this variable is the same as in subreport; but if subreport is blank then this variable will be the same data as in last item, which is wrong.


GH#1 Item 1 (subreport-openorder=)275
GF#1 get 275 from subreport

GH#1 Item 2 (subreport-openorder=)
GF#1 get 275 from subreport

Notice Item 2 should be 0 but still the same as last Item.



Thanks for any kind of helps,
Frances










variable in GF#1 in main report

whileprintingrecords;
shared numbervar OpenOrder;
"get" & OpenOrder & "from subreport
 
You need to add a reset formula in the main report:

whileprintingrecords;
shared numbervar OpenOrder := 0;

Place this in a GH_a section (it can be suppressed), and place your subreport in GH_b.

-LB
 
You are great! now completely fixed my problem. Thank you so much,LB!

Frances
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top