Question

i have a column of datatype money in mssql 2k5... colX...

i want to show this colx in two columns, col1 and col2 according to colY in crystalreport as:

res = 100.00
col1       col2     col3
10.00      0        90.00
0          1.00     91.00
0          5.00     96.00
50.00      0        46.00 
.
.

but what i am getting now is:

res = 100.00
col1       col2     col3
10.00      0        100.00
0          1.00     100.00
0          5.00     100.00
50.00      0        100.00 
.
.

Following is the formula i am using for col3...

    dim ob
    ob={TABLE.res}
    WhileReadingRecords
    if {TABLE.colY}="C" then
        ob=ob-{TABLE.colX}
        formula=ob
    else
       ob=ob+{TABLE.colX}
       formula=ob
    end if

Please do answer if u have any solution or reference...

Was it helpful?

Solution

the above mentioned issue is fixed...

i just declared a global variable in the header section of the report...

Global ob as currency
ob={TABLE.res}
formula=ob

and the balance forwarding logic remains in its place (detail section of the report) with the one change made...

Global ob as currency
WhileReadingRecords
if {TABLE.colY}="C" then
    ob=ob-{TABLE.colX}
else
   ob=ob+{TABLE.colX}
end if
formula=ob

Now i am getting what i needed... as;

res = 100.00
col1       col2     col3
10.00      0        90.00
0          1.00     91.00
0          5.00     96.00
50.00      0        46.00 
.
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top