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

Help with duplicate from formula

Status
Not open for further replies.

bv0719

MIS
Dec 19, 2002
131
US
I have a report that uses a shared variable from a subreport. The amount returned to the main report from the shared variable on the subreport duplicates the value for each field that are zero. This is the formula:

WhilePrintingrecords;
Shared numberVar intX;
intX:= Sum ({@NET}, {@CONVERT})

This is a sample of the result:
GL NUM AMT Budg Vari
600.0200 5758.00 5900.00 -142.00
601.0200 5758.00 0.00 5758.00 (AMT should be 0)
602.0200 5758.00 0.00 5758.00 (AMT should be 0)
603.0200 25.00 50.00 -25.00
etc.

Any thoughts on how to suppress this other than using the suppress if duplicated function since the Variance field is based off a formula.
Thanks,
BV
 
in the section immediately before you run the subreport or immediately after using the shared variable in your formula put the following formula

@ResetTotal

WhilePrintingRecords;
Shared numberVar intX := 0;

Or this might work too in the subreport except if there are no records then you will not reset the value of intX

WhilePrintingrecords;
Shared numberVar intX := 0;
intX:= Sum ({@NET}, {@CONVERT})

The first option handles both cases




Jim Broadbent
 
Jim,

I have the subreport in the Da section and the report data that I want to see in the Db section. I setup Da to underlay. Are you saying I should add a Dc section and place the @resettotal formula there?

thanks,
BV
 
you could do that and suppress the section so it won't show

Jim Broadbent
 
I the field is suppressed I thought the formula would not run.
 
It is only subreports that don't run when suppressed..

Lisa
 
Thanks. Thought so but had to ask. I tried adding the :=0 to the formula with no effect. Still working at it.
 
Lisa is right...Suppressing a field in a report just hides it from view

Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top