All we need to know now is what the problem is (:-)

Solved

Posted on 2007-07-20

Experts:

I'm having a problem with a variable not accumulating correctly.

This is in GROUP HEADER:

//GF1

whileprintingrecords;

global numbervar APPROVEDACTAMT1:=0;

This is in DETAILS SECTION:

//ACCUMULATION FORMULA

whileprintingrecords;

global numbervar APPROVEDACTAMT1:=

IF({@Installment})="Activation" then

IF({@DisplayAttempts}) = '1' THEN

if({tblPaymentTransactionResult.resultCode})= '1'

then {tblPaymentTransaction.amt}+ APPROVEDACTAMT1

ELSE 0;

This is the display formula in GROUP FOOTER:

//GF1

whileprintingrecords;

global numbervar APPROVEDACTAMT1;

I think the problem may related to this formula that is a part of the ACCUMULATION formula that is in the DETAILS SECTION:

//@DisplayAttempts

whileprintingrecords;

Global numberVar intAttempts;

If OnFirstRecord OR {@Installment}

<> Previous({@Installment}) then

intAttempts := 1

else

If OnFirstRecord OR {Order_Details.OrderID}

<> Previous({Order_Details.OrderID}) then

intAttempts := 1

else

intAttempts := intAttempts + 1;

If intAttempts >= 3 then

"3"

else

CStr(intAttempts,0);

OR ....IT could be an issue with the formula that I'm using to GROUP ON:

(incidentally, I cannot use WHILEPRINTINGRECORDS as I get an error

group chosen on a NON-RECURRING field)

//Frequency

//whileprintingrecords;

if ubound(split({tblProducts.ProductName},"-")) < 3

then "N/A"

else

if split({tblProducts.ProductName},"-")[3] = 'BW' then 'BW'

else if split({tblProducts.ProductName},"-")[3] = 'E2W' then 'BW'

else

if split({tblProducts.ProductName},"-")[2] = 'BW' then 'BW'

else if split({tblProducts.ProductName},"-")[2] = 'E2W' then 'BW'

else

if left({tblProducts.ProductName},3)='18M'

then split({tblProducts.ProductName},"-")[4]

else

if left({tblProducts.ProductName},3)='MPD'

then split({tblProducts.ProductName},"-")[2]

else

if left({tblProducts.ProductName},3)='DLU'

then split({tblProducts.ProductName},"-")[2]

else

split({tblProducts.ProductName},"-")[3]

I realize that this is not alot to go on...but let me know if you have questions......ANY AND ALL advice on WHY my ACCUMULATION FORMULA is not working would be much appreciated. The formula DOES start to accumulate, but It appears to reset itself to ZERO for no apparent reason.

Thanks

MikeV

I'm having a problem with a variable not accumulating correctly.

This is in GROUP HEADER:

//GF1

whileprintingrecords;

global numbervar APPROVEDACTAMT1:=0;

This is in DETAILS SECTION:

//ACCUMULATION FORMULA

whileprintingrecords;

global numbervar APPROVEDACTAMT1:=

IF({@Installment})="Activa

IF({@DisplayAttempts}) = '1' THEN

if({tblPaymentTransactionR

then {tblPaymentTransaction.amt

ELSE 0;

This is the display formula in GROUP FOOTER:

//GF1

whileprintingrecords;

global numbervar APPROVEDACTAMT1;

I think the problem may related to this formula that is a part of the ACCUMULATION formula that is in the DETAILS SECTION:

//@DisplayAttempts

whileprintingrecords;

Global numberVar intAttempts;

If OnFirstRecord OR {@Installment}

<> Previous({@Installment}) then

intAttempts := 1

else

If OnFirstRecord OR {Order_Details.OrderID}

<> Previous({Order_Details.Or

intAttempts := 1

else

intAttempts := intAttempts + 1;

If intAttempts >= 3 then

"3"

else

CStr(intAttempts,0);

OR ....IT could be an issue with the formula that I'm using to GROUP ON:

(incidentally, I cannot use WHILEPRINTINGRECORDS as I get an error

group chosen on a NON-RECURRING field)

//Frequency

//whileprintingrecords;

if ubound(split({tblProducts.

then "N/A"

else

if split({tblProducts.Product

else if split({tblProducts.Product

else

if split({tblProducts.Product

else if split({tblProducts.Product

else

if left({tblProducts.ProductN

then split({tblProducts.Product

else

if left({tblProducts.ProductN

then split({tblProducts.Product

else

if left({tblProducts.ProductN

then split({tblProducts.Product

else

split({tblProducts.Product

I realize that this is not alot to go on...but let me know if you have questions......ANY AND ALL advice on WHY my ACCUMULATION FORMULA is not working would be much appreciated. The formula DOES start to accumulate, but It appears to reset itself to ZERO for no apparent reason.

Thanks

MikeV

8 Comments

All we need to know now is what the problem is (:-)

I would expect that to happen based on this:

global numbervar APPROVEDACTAMT1:=

IF ........ then

{tblPaymentTransaction.amt

ELSE

0;

If you don't want to zero out this variable make your else clause be:

ELSE

APPROVEDACTAMT1;

EVEN when I do change it to the above recommendation...I still get a ZERO...the formula is defaulting back to zero...and I can't see why it is doing this.

Again,...I think it might have something to do with this formula,....WHICH THE GROUP IS BASED ON...

//Frequency

//whileprintingrecords;

if ubound(split({tblProducts.

then "N/A"

else

if split({tblProducts.Product

else if split({tblProducts.Product

else

if split({tblProducts.Product

else if split({tblProducts.Product

else

if left({tblProducts.ProductN

then split({tblProducts.Product

else

if left({tblProducts.ProductN

then split({tblProducts.Product

else

if left({tblProducts.ProductN

then split({tblProducts.Product

else

split({tblProducts.Product

DO YOU see any potential issues / problems...?

MikeV

Try your formula like this:

//ACCUMULATION FORMULA

whileprintingrecords;

global numbervar APPROVEDACTAMT1:=

IF({@Installment})="Activa

IF({@DisplayAttempts}) = '1' THEN

if({tblPaymentTransactionR

{tblPaymentTransaction.amt

ELSE

APPROVEDACTAMT1

Else

APPROVEDACTAMT1

Else

APPROVEDACTAMT1;

Or another alternative is to use a local variable to hold the incremental amount:

//ACCUMULATION FORMULA

whileprintingrecords;

numberVar Incremental := 0;

global numbervar APPROVEDACTAMT1;

IF({@Installment})="Activa

IF({@DisplayAttempts}) = '1' THEN

if({tblPaymentTransactionR

then Incremental := {tblPaymentTransaction.amt

APPROVEDACTAMT1 := APPROVEDACTAMT1 + Incremental;

I prefer the second method myself because it avoids getting a null value into a shared variable - even if you make a mistake in your if..then part of the formula the worst that would happen is the value won't increment.

IF({@Installment})="Activa

IF({@DisplayAttempts}) = '1' THEN

if({tblPaymentTransactionR

then {tblPaymentTransaction.amt

ELSE 0;

ARe you satisfied that the Ifs are ok here?

It will rest to zero if installment is not 'Activation' Or if DiplayAttempts' is not 1

or if resultcode is not 1

I have approximately...78 GROUP FOOTER sections..that I added to GF1. I did this to format the report to look like I want it to...I'm going to DISPLAY variables based on Payment NUMBER...for each GroupFooter.

so my reoprt looks like this;

GHeader1

//GF1

whileprintingrecords;

global numbervar APPROVEDACTAMT1:=0;

This is the MAIN GROUP FORMULA used:

//whileprintingrecords;

if ubound(split({tblProducts.

then "N/A"

else

if split({tblProducts.Product

else if split({tblProducts.Product

else

if split({tblProducts.Product

else if split({tblProducts.Product

else

if left({tblProducts.ProductN

then split({tblProducts.Product

else

if left({tblProducts.ProductN

then split({tblProducts.Product

else

if left({tblProducts.ProductN

then split({tblProducts.Product

else

split({tblProducts.Product

DETAILS SECTION

//ACCUMULATION FORMULA

whileprintingrecords;

global numbervar APPROVEDACTAMT1:=

IF({@Installment})="Activa

IF({@DisplayAttempts}) = '1' THEN

if({tblPaymentTransactionR

then {tblPaymentTransaction.amt

ELSE 0;

GROUP FOOTER SECTION

//GF1

whileprintingrecords;

global numbervar APPROVEDACTAMT1;

M

By clicking you are agreeing to Experts Exchange's Terms of Use.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**9** Experts available now in Live!