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

{Subreport field} / {subreport field} in a formula? 1

Status
Not open for further replies.

willz99ta

IS-IT--Management
Sep 15, 2004
132
US
Thanks for your help,

I am trying to figure out how to have a forumla field on my report that uses the information from two different subreports. Is there a way to do that?

Thanks,
Will
 
You need to set up the values as shared variables within each subreport, e.g.,

//{@sub1value}:
whileprintingrecords;
shared numbervar subamt1 := sum({table.amt});

//{@sub2value}:
whileprintingrecords;
shared numbervar subamt2 := sum({table.amt});

Then in the main report, in a section below the ones containing the subs, you can use a formula like this:

//{@mainrptformula}:
whileprintingrecords;
shared numbervar subamt1;
shared numbervar subamt2;
subamt1/subamt2

You might also need a reset formula in a section above the one containing the subs:

whileprintingrecords;
shared numbervar subamt1 := 0;
shared numbervar subamt2 := 0;

-LB
 
Ugh! I have setup the variables in my subreport and report and I can't get the report variable (pulling from the subreport shared variable) to show anything but 0.00.

My subreport's formula field(@RecsYes) reads:
whileprintingrecords;
shared numbervar RecsYes := distinctcount({PORECEIVE.PO_NUMBER})

I placed this variable inside my subreport and it shows 186

My report's formula field(@RVI Yesterday) reads:
whileprintingrecords;
shared numbervar RecsYes;
RecsYes

When I place this on my report it shows "0.00"

This variable is placed on a footer benether the footer that the subreport is on.

I placed a reset formula in the report header. It reads:
whileprintingrecords;
shared numbervar RecsYes :=0;

Thanks again for your help,
Will
 
Please identify the exact sections in which you are placing the subreport and the main report formula. Also, how is the subreport linked to the main report?

-LB
 
Hmm, when I restarted Crystal, everything worked... strange!

Thanks for your help,
Will
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top