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

Shared formula from main to subreport 1

Status
Not open for further replies.

hencyt

MIS
Mar 14, 2003
122
US
I have a report and a subreport within it. I had to place the subreport in a detailsB section because I want it to repeat it for every detail in the main report. That is working. But I want to pass a value from the detailsA in main report to subreport. I created a shared variable, but it isn't populating I only get 0. Just to see if the variable was working at all I changed it to another value in the main report(from the main report group header) and it worked. The report is for bills of materials and their components. It is first grouped by bill number then det A is populated with that bill's components. The subreport is the same setup but pulls the components of the DetA components. This is kinda how it looks:
Parameter-qty to produce= 100
grp header - item# info qtyperbill qtyreq qtyonhand
detA - 02124196 candleA 10 1000 50
detB (subreport) wax .25 250 100

The field that won't populate is 250. I am trying to share the qtyreq (1000) with the subreport and use it to calculate 250 (1000 X 0.25). But all I get is zero. I have tried placing the shared vaiable field all over the main report and it doesn't help. Is it because I am trying to share a value from the details? Or because I have put the subreport in the details?

Thanks in advance for any advice,

Sunny

Crystal 8.5, SQL db
 
Sunny,

As long as you're placing the shared variable set up formula in the details A section of the main report, and calling it succesfully in the subreport, you should be able to do this.

Can you post your formulae, and also explain where it's placed in the main report?

Thanks,

Naith
 
Naith,

Thanks for the response. Here is the formula in the main report which is placed in detailsA of main report:

whileprintingrecords;
shared numbervar mainqtyreq;
{@QtyReq}

Formula for qtyreq:
({?Qty to Produce} * {BOM_VIEW.QtyPerBill})

subreport is in DetB of main report and has this formula (called @sharedqtyreq2)in the subreport details:

whileprintingrecords;
shared numbervar mainqtyreq;
mainqtyreq

the result of that formula I would like to use in this formula in the subreport:

({BM2_BillMaterialsDetail.QtyPerBill} * {@sharedqtyreq2})

But it turns out to be 0, because the result of the shared variable is 0.
I hope that helps.

Thanks,
Sunny


 
That's because you aren't assigning the value of {@QtyReq} to the variable in the main report.

Your first formula should look like this:
Code:
whileprintingrecords;
shared numbervar mainqtyreq := {@QtyReq};
All the best,

Naith
 
Naith,

Wow. I can't believe forgot my = sign. I was making the problem much harder than it was! That is why it helps to have someone else take a look at your work. It all starts looking the same after awhile.

THANKS!!
Sunny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top