Crystal report running total sum fluctuates between two values

79 views Asked by At

Im trying to sum detail records with a running total formula placed in report footer.

The running total evalution formula follows

global numbervar prev_ordnumber;
global numbervar prev_invnbr;

if prev_invnbr <> tonumber({Command.INVOICE_NBR}) or prev_ordnumber <> tonumber({Command.ORD_NBR})  then
(
    prev_invnbr := tonumber({Command.INVOICE_NBR});
    if  {Command.PYMTIND} = 'Y'  and {Command.ROW_NUMBER} = 1  and prev_ordnumber <> tonumber({Command.ORD_NBR}) then
    (
        prev_ordnumber := tonumber({Command.ORD_NBR});
        true;
    )
    else 
    (   
        prev_ordnumber := tonumber({Command.ORD_NBR});
        false;
    )
)
else
(
    prev_invnbr := tonumber({Command.INVOICE_NBR});
    prev_ordnumber := tonumber({Command.ORD_NBR});
   false;
)

The reset condition is set to never.

The problem is the running total would return me 130 for some times and 160 for few times.Kindly help.

0

There are 0 answers