Try this:
whileprintingrecords;
numbervar cumul;
numbervar cumultot;
numbervar cumulnet;
if gridrowcolumnvalue("ZGCB_M01_ZBOBJ_ZGCB_M01_QFIN_ANLSIS1_V7.[4LVE0F039ABA0HJHVHOLF3BQD]")= "Cumulative Total Discounted Project Cost Cash Flows"
then
(
(
if cumul <0 then
"("+ totext(cumul*-1,0,",")+")" else
totext(cumul,0,",")
)
else
(
if currentfieldvalue<0 then
"("+totext(currentfieldvalue*-1,0,",")+")" else
totext(currentfieldvalue,0,",")
)
) else
if gridrowcolumnvalue("ZGCB_M01_ZBOBJ_ZGCB_M01_QFIN_ANLSIS1_V7.[4LVE0F039ABA0HJHVHOLF3BQD]")= "Cumulative Total Discounted After Tax Return on Project"
then
(
(
if cumultot <0 then
"("+ totext(cumultot*-1,0,",")+")" else
totext(cumultot,0,",")
)
else
(
if currentfieldvalue<0 then
"("+totext(currentfieldvalue*-1,0,",")+")" else
totext(currentfieldvalue,0,",")
)
) else
if gridrowcolumnvalue("ZGCB_M01_ZBOBJ_ZGCB_M01_QFIN_ANLSIS1_V7.[4LVE0F039ABA0HJHVHOLF3BQD]")= "Cumulative Net Discounted After Tax Cash Flows"
then
(
(
if cumulnet <0 then
"("+ totext(cumulnet*-1,0,",")+")" else
totext(cumulnet,0,",")
) else
(
if currentfieldvalue<0 then
"("+totext(currentfieldvalue*-1,0,",")+")" else
totext(currentfieldvalue,0,",")
)
)
PS. Your reset formula should reset all three variables, too.
-LB