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 Variable Sub to Main 1

Status
Not open for further replies.

YANKRAY

Technical User
Nov 7, 2003
283
Using CR 10.0

I have a report (AVG DAYS) that calculates the Avg Start Day, and the Avg Flow Days for a Work card that has multiple repeats.

The report is grouped by the WORK_CARD so only the Work Card number, Avg Start Day, and Avg Flow Days is shown.

I have another report (WO PLAN) that has each Work Card in the Details section. It is grouped by AREA then by STATION and the Detail work cards follow.

I am trying to bring in the Avg Start Day and Avg Flow Day from the (AVG DAYS) report for each WORK_CARD.

I created the Shared Variable for the Avg Flow Days

WhilePrintingRecords;
Shared NumberVar AVGFLOWDAY;
AVGFLOWDAY := Average ({@Flow Days}, {AAII_WORK_ORDER_INFO.WORK_CARD_NO});
AVGFLOWDAY

When this is placed in the (AVG DAYS) report the result is correct.

When I insert the AVG DAYS report as a subreport into the WO Plan report, the Shared varaiable formula when placed in the Details line shows 0.0.

WhilePrintingRecords;
Shared NumberVar

AVGFLOWDAY := AVGFLOWDAY

I have placed the Sub-report in every location I could but still 0.0 or the sub-report runs and runs.

Any assistance would be appreciated.

Thanks,
Ray
 
So you linked the sub on the work order field, correct? If you want the avg to show for each detail record, place the sub in detail_b, place the shared variable in the main report in detail_c, and place a reset formula for the shared variable in detail_a. You can suppress detail_a, but you cannot suppress detail_b or the subreport itself.

Instead, remove the borders of the sub, suppress all sections within the sub, and format the subreport object by right clicking on it->format subreport->subreport tab->check "suppress blank subreport". Then in the section expert of the main report, select detail_b and check "suppress blank section". This should cause detail_b to disappear, leaving detail_c to display with the shared value.

-LB
 
LB,

The average is the variable from the sub report.
It is calculated on the subreport.

I only wish to bring over this result which is a grouped level entry by Work Card on the subreport.

There is no calculation being done on the main report.

the AVGFLOWDAY is just the name of my variable.

The calculation cannot be done on the main report because of two different data sets.
 
I understand that the calculation is done in the subreport, and I understand your other points as well. For some reason you want to show the value via a shared variable in the main report, so I was explaining what you need to do in order to accomplish this. The reset formula is necessary only if the subreport value can be null.

Another approach would be to just suppress all sections of the subreport except the footer where you have the shared variable, remove the subreport borders, and resize the sub so that you can display it directly in the detail section without using a shared variable. But you do have to link the sub to the main report on WO.

-LB
 
Thanks LB.

I was able to get my result using the Link to Work Card.

It was slow running, but I will not need to refresh it too often.

Thanks again,
Ray
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top