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!

how to get a value from subreport?

Status
Not open for further replies.

francesguan

Technical User
Jan 26, 2006
52
CA
Hi, all,

I am trying to count the number of total lines from subreport, then compare to how many lines need to be shown up in packing slip, which is in main report; the purpose is to prevent partial shipping.

is there anybody know how to get the value in subreport to use in main report?

Thanks in advance!
Frances Guan
 
Do you mean the number of records in the subreport, or what is meant by number of total lines? Is this the number of summaries (number of total lines)?

You can place the following formula in the subreport report footer to get the number of records:

whileprintingrecords;
shared numbervar TotalRows:= count({table.field})

Then in any subsequent section to the subreport in the main report you can retrieve the value using:

whileprintingrecords;
shared numbervar TotalRows;
"There are " & TotalRows & " in the subreport."

-k

 
YOu will need to create a shared variable in subreport.

Formula in Subreport.

@eval variable
Whileprintingrecords;

Shared Numbervar recordNo:= count(fieldName)

To use in main report add following to another formula

Whileprintingrecords;

Shared Numbervar recordNo;

You can then use recordNo any way in the rest of the formula.

Make sure you place the subreport in a group or position on the main whare it will be evaluated before you need to use the Variable value.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top