OS/2, eCS & ArcaOS - Technical > Programming

Rexx cumulative values

<< < (2/2)

Per E. Johannessen:
Thank you both.

Alex, I got this when running your code:
 *** Error 41 Bad aritmetic conversion

Lars, works fine.

Initially I had the idea that the container should display these cumulative values but there is actually no point in that.
Will use the code to create some accounting reports which also can be printed to screen.

Per E. Johannessen:
Tried to create a report, which works but it is missing the cumulative values.
I added the following to Lars' code:

    reprows = 0
ok = VRMethod( "QRY_2", "MoveFirst" )
do while( ok = 1 )
    call VRMethod "QRY_2", "RowData", "data."
    reprows=reprows+1
    table.reprows.TEKSTFELT = data.1
    table.reprows.TALLFLT1 = data.2
    table.reprows.TALLFLT2 = data.3

ok = VRMethod( "QRY_2", "MoveNext" )
end

table.0=reprows

DO i=1 TO table.0

END i

hwnd = VRGet( "Window1", "HWnd" )

rc=VpPrintReport(hwnd, 'REP_HBAKKM.vpt', 'table.', '<PREVIEW>' )

call QRY_2_Fini

return

Attached is the resulting report which would be fine if the column now showing data.3 would show the cumulative instead.

Per E. Johannessen:
Well, there is only data from "QRY_2" that is being used in the report.

Writing to a txt-file is OK, like this;
        outfile = data.1 ',' data.2 ',' data.3
        out = lineout(testakkm.txt,outfile)

So, how to define the same data as source for the VPR-report REP_HBAKKM.vpt ?


Per E. Johannessen:
In case someone is interested, this code works:

   reprows = 0

ok = VRMethod( "QRY_2", "MoveFirst" )
identifier = ''
sum = 0
do while( ok = 1 )
   call VRMethod "QRY_2", "RowData", "data."
   if data.1 <> identifier then do
   identifier = data.1
   sum = data.2

   end
   else do
   sum = sum + data.2
   end
   data.3 = sum

   reprows=reprows+1
   data.reprows.TEKSTFLT = data.1
   data.reprows.TALLFLT1 = data.2
   data.reprows.AKKUM = data.3

ok = VRMethod( "QRY_2", "MoveNext" )
end

data.0=reprows

DO i=1 TO data.0

END i

hwnd = VRGet( "Window1", "HWnd" )

rc=VpPrintReport(hwnd, 'REP_HBAKKM.vpt', 'data.', '<PREVIEW>' )

Navigation

[0] Message Index

[*] Previous page

Go to full version