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!

using multiple subreports on crystal 7 mr1

Status
Not open for further replies.

JohnWoolliscroft

Programmer
May 13, 2010
8
GB
Hello
I am trying to produce a cost report for a part based on its components & routes.

I have a subreport linked to the parent part displaying all operations, labour, material & overhead costs for this part. These are shown totalled at the bottom of the subreport and passed out as shared variables.

A second subreport linked to the parent part displays all components, labour, material & ovehead costs fro this part. Again these are shown totalled at the bottom of the subreport and passed out as shared variables.

In the main body of the report I have 4 columns showing the combined labour, material, overhead & total costs (from the shared variables) for the two subreports.

A new page is started for each new parent part, and generally the operations & components subreporst fit within one page. The report works fine for 99% of the time.

However occaisionally I get the final total line showing on the next page, and from then on the shared variables never seem to get reset.

Is there a bug in crystal - I have had this occur on other reports, but this time it is really bugging me as I cannot solve it.

Any help would be much appreciated.
 
Variables can get confused if you have Repeat group header on each page checked.

Ian
 
Thanks for the quick response.
Ah! that would be the case for other times I have had this problem.
However I have written a view which drills down from the top level part and contains parent, component plus other items.
Consequently I have no need to group any of the records. They are all in details sections. Below shows the structure of the report:-
Report header
Page header (a-d)
Detail (a) shows the part & description
Detail (b) contains the operations subreport
Detail (c) contains the components subreport
Detail (d) contains another subreport (special type of part)
Detail (e) contains the combined totals of operations & components (details b & c)
Detail (f) contains the totals of details d
Report footer (a-b)
Page footer
 
You need to have a formula that resets the shared variables. This could be placed in a suppressed detail_g section:

whileprintingrecords;
shared numbervar x := 0; //replace x with your variable name
shared numbervar y := 0;//etc.

-LB
 
I have a shared variables clear at the start of each subreport, I have also a shared variables clear in the detail section e.

In trying to debug this problem, I have even resorted to showing the shared variables of the operations at the bottom of the operations subreport (detail b), and also at the top of the components subreport (detail c).

All is fine (ie the two sets of numbers match) until the total line prints on the next page.
After that the operations totals appearing in the components subreport do not change.

So we have totals in detail b showing one set of numbers and the same variables in detail c showing a set of numbers from before the detail e section went onto the next page.

Very odd.
 
Are there any formulas in the page header? Are you using crosstabs in the subreports?

Are you saying that when every part fits onto its own page that the components subreport executes correctly in all pages?

-LB
 
I am not using a cross tab report.

The only calculations on the report header are:-
clearing an error counter
setting a cost price based on an input parameter
setting a margin based on this cost price

All the rest are just text fields or displayed database fields.

In the parts I am looking at at the moment the max component lines displayed is 18.
By reducing the height of the subreport detail - I can force the total lines to print on the same page and it is ok.
If I widen the height slightly & the last line moves to a new page, the we get problems.

Weird!
 
PS
Page 1 has a working calculation.
Page 2 is the culprit overflow page.
Page 7 is the incorrect page
 
What I notice is that on the pages where results are unexpected, the bom subreport is displaying only one RF section--the other sections are conditionally suppressed because bom.bomchild is null. is this section really intended to display in this case? I'm not quite sure what the impact is.

-LB
 
On our system we have parts beginning with 1 which are lithos & the cost calculation is based on a supplementary file containing a set of parameters and gold weights which allow the costing of that type of part. There is an operation of zero time, and it is there because the works order system requires all parts to have at least one operation.

All others parts have a full list of operations and have a selection of components.

Section Dc is the operation subreport and always displays.
Section Dd is the normal bom subreport with components and is only supressed when the part begins with 1
section De is the litho subreport and is suprressed when the part does not begin with 1.

Pages 3 - 6 are the litho parts and the report is as it should be.

Page 1 is a normal part and is as it should be.

Page 2 has an awful lot of components and the bom subreport all fits on the page with the subreport RFb being the last item on page 2. The section Df for the current part is printed at the top of page 3.

Page 3 starts with section Df as explained above, followed by a new part starting with 1 so we see sections Da, Db, De & Dg (repeating for 7 more litho parts)

Page 7 is now back to normal part printing sections Da, Db, Dc, Dd & Df. But the values in red at the bottom of Dc should be the same as the values in red at the top of Dd as on pages 1 & 2.

As I said before if you tweak the height of the bom subreport details and all now fit on page 2, then page 7 is ok.
 
Please identify the part number where you are seeing this behavior. The only place I don't see matches are for the BOM sub where only the sub report footer is displaying--and that's because the values you want to see are in the report header. When I changed the height of the details within the BOM sub nothing changed. I am looking at this with CR XI.

-LB
 
OK the top level part is in the darker grey bit at the top.

The lighter grey bit contains the part to be costed - on the first page it is the same as the part in the darker grey bit (90PINKRO00100).

On page 2 we have part number 87PINKRO00100. This contains ops 5 to 70, and components beginning with 1 (8 pairs) each pair contains the main component and a copy which equates to the standard loss for this part. In the first pair we have qty = 1 & qty = 0.0204.

The next grey bar On page 2 is the sum of the components and operations split into labour, material & overhead (for labour that is 1.8066 + 2.8242 = 4.6308)

The red calcs are the shared variable from the operations sub report, passed to the bom subreport & repeated in that section.

As you can see these match near the to of the report.
In the greay bar at the bottom we have another copy of the operations shared variables plus the bom shared variables in pairs for labour then material then obverhead. The first two being the pair I have mentioned above.

The next pages are costs of the compenents mentioned in page 2 ie 4 pages of lithos where we have an operation sub report section and the litho sub report section. The values for these operations will always be 0, and we dont add them to the litho subreport, so only one red set of shared variables per part (eg 11PINKRO200011 & 11PINKRO200012 on page 3.

You will notice that the top of page 3 contains section Df for the 87PINKRO00100 part.

On page 7 we get the 80SURRCD00100 part in the lighter grey section. This is where the red cals do not match.

The operations shared variables in the upper section match that subreport.

The shared variables in the components subreport repeat the variables from page 2 for the 87PINKRO00100 part component subreport.

However if I make page 2 all fit on 1 page (including Df) then these component variabes on page 7 match the operations from page 7.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top