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

Referencing Subreports

Status
Not open for further replies.

bigmerf

MIS
Oct 4, 2002
247
US
I have a Crystal Report (version 11), where I have the main report then a subreport embedded. I want to create a formula field that references data from the subreport directly.

For instance, if the value in {FieldA} is empty or NULL on the subreport, then display the value in {FieldB} from the main report.

Is this possible?

Thanks!
 
You would have to share the field from the subreport. You would set this up in a formula like this:

whileprintingrecords;
shared stringvar A := {table.fieldA};

Then in the main report, in a section (e.g., detail_c) below the one in which the sub is located (e.g., detail_b), you can do a comparison:

whileprintingrecords;
shared stringvar A;
if A = "" then
{table.fieldB} else
A

You should have a reset formula in a section before the sub (e.g., detail_a):

whileprintingrecords;
shared stringvar A := "";

For further help, you should explain in what report section the subreport is located, and identify the datatype of the fields.

-LB
 
Great, that helps a great deal. Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top