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!

pass a variable to a subreport?

Status
Not open for further replies.

sdkramer

Programmer
Oct 1, 2005
9
US
Okay I've got a subreport that displays a bunch of values. I am trying to flag values that are outside an acceptable range. E.g. lets say we only tolerate 1.0 to 1.5 mm somethings if a value is too high, or low I want to set it off, maybe with asterisks. I need to pass these values, from my table, into the subreport for comparison. It's not really a subreport link, because it doesn't "link" to any of the data items in the table, what can I do?
 
it's probably worth mentioning that I'm working with CR 6.0.
 
You haven't provided much information to go on. You can pass values from a main report to a subreport using a shared variable. In the main report, create a formula like the following:

whileprintingrecords;
shared numbervar startval := {table.field1};
shared numbervar endval := {table.field2};

Place this somewhere on the the main report and suppress it if you like.

Then in the subreport, which must be located in a section below the one in which the shared variable is located in the main report, create a formula like the following:

whileprintingrecords;
shared numbervar startval;
shared numbervar endval;

if {sub.numberfield} in startval to endval then
totext({sub.numberfield},1,"") else //assuming one decimal
"*"+totext({sub.numberfield},1,"")+"*"

If you want more help, you should explain your main report group structure and how you are deriving the values you want to compare with the subreport values. You should also explain where the subreport is located and if there are any links, tell us what those are.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top