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!

Reset variable problem 1

Status
Not open for further replies.

Wayne79

Programmer
Sep 8, 2005
36
US
Using CR8.5

I have a sub report on the detail line. It calculates the sum of Other_Charges based on a Bill_Number (Link from main report to sub report)

On the sub report I get the total via this formula:
//Placed in Detail B
WhilePrintingRecords;
shared numberVar OtherChargesTotal := OtherChargesTotal + {ACHARGE_TLORDER.FUNCTIONAL_AMT}

On the main report I have a couple of formulas:
//Resets the OtherChargesTotal variable which is populated via the sub report SR_OtherCharges
//Placed in G3 header
shared numbervar OtherChargesTotal := 0;

//Gets the Other Charges value from the sub report
//Placed in Detail B
WhilePrintingRecords;
shared numberVar OtherChargesTotal;

//Resets the Group 3 (TLORDER.BILL_NUMBER) Other Charges Total formula field
//Placed in G3 Header
numbervar G3_OCTotal := 0;

//Calculates the total of Other Charges for each Bill Number
//Placed in the G3 Footer.
numbervar G3_OCTotal := G3_OCTotal + {@OtherCharges}

//Resets the Group 2 (DRIVER.DRIVER_TYPE) Other Charges Total formula field
//Placed in G2 Header
numbervar G2_OCTotal := 0;

//Calculates the total of Other Charges by Driver Type
//Placed in G2 Footer
numbervar G2_OCTotal := G2_OCTotal + {@G3_OtherChargesTotal}

Data looks like this:
Sub Report On Detail Line: 52.00
@OtherCharges on Detail B: 52.00
@G3_OC_Total on G3 Footer: 52.00

Sub Report On Detail Line: 52.00
@OtherCharges on Detail B: 52.00
@G3_OC_Total on G3 Footer: 104.00

Sub Report On Detail Line: 78.00
@OtherCharges on Detail B: 78.00
@G3_OC_Total on G3 Footer: 182.00

Sub Report On Detail Line: 130.00
@OtherCharges on Detail B: 130.00
@G3_OC_Total on G3 Footer: 312.00

Sub Report On Detail Line: 83.00
@OtherCharges on Detail B: 83.00
@G3_OC_Total on G3 Footer: 395.00

To this point all seems correct.

@G2_OC_Total on G2 Footer: 478.00

This line sould be 395.00 instead of 395.00 + 83.00.

Either my formulas are in the wrong places or the reset values are. @G3_OC_Total does not appear to be reseting.

Wayne
 
Try something like this

GH#3A - {TLORDER.Bill_Number}
@Reset_G3_OC
WhileprintingRevords;
numbervar G3_OCTotal := 0;
shared numbervar OtherChargesTotal := 0;
GH#3B - {TLORDER.Bill_Number} and subreport
Details - @OtherCharges and other fields
WhilePrintingRecords;
shared numberVar OtherChargesTotal;

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
In the section expert I clicked the Details B section and then clicked the Underlay Following Sections checkbox. I did not add any code. Is this correct? if so it appeared to have no effect.

Working on the other changes recommended.
 
I moved the subreport to the GH#3. after creating a A and B sections. A is suppressed and B is not but it needs to be.

Same problem as before. Compressed the subreports as small as possible but unable to hide completely. Did the Underlay thing and it didn't work either.
 
The underlay following sections should be set on the section above the one containing the subreport.

-LB
 
Tried checking the Underlay Following Section checkbox on the
Report Header
Page Header
GH#1
GH#2
GH#3 A
GH#3 B

individually and all together.

Still not working, or else not working as I'd like.

Is there any way I can tell if it is working?

What I'd like to happen is the GH#3 B space be eliminated.
 
The underlay should be on Gh#2 and on GH#3a. This will cause the subreport in GH#3b to lie under the GH#2 fields.

-LB
 
Group headers 1, 2, 3A are all suppressed.

Clicked the underlay check box for GH#2 and GH#3A - no effect.

Clicked for GH#1, GH#2 and GH#3A - still no effect.
 
Yes, if they are suppressed, underlay will not help. The point of underlaying is to either to align a display with a higher level section or to hide a section by laying it under another displayed section.

-LB
 
Unsuppressed GH#1.
Clicked underlay for GH#2 and GH#3A

No effect.

Added GH#1

No effect.
 
Not sure why you are trying this if you want these headers suppressed anyway. You would need to unsuppress GH#2.

-LB
 
Reason is report, with details hidden, looks like this:

Page Header - Field1 Field2 Field3









GF#2 Summary- Field1 Field2 Field3









GF#2 Summary- Field1 Field2 Field3
GF#1 Summary- Field1 Field2 Field3
Report Footer-Field1 Field2 Field3
Page Footer

Gaps between summary lines are not apparent when the detail is displayed which is parameter based.

Gap is formed by not being able to suppress the subreport and still have it calculate. I've shrunk the subreport to as small as I can but it stills leaves a small gap displayed. The more detail records there are the larger the gap.

I unsuppressed GH#1 and GH#2.
Set GH#@ and GH#3A to underlay.
No effect.
 
Well, you are getting an effect, since the first instance of GH#3 will be laid under Gh#2. The problem is that the subsequent instances of GH#3 are visible, so that underlay will not solve your problem. I was mistakenly thinking you only had one instance of GH#3 per GH#2.

I think you either have to use an unlinked subreport in the report header and use arrays (complicated) to share the appropriate costs or remove the subreport and use a combination of running totals and suppression to eliminate unwanted records (if that is why you used a subreport in the first place). Sorry.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top