Author Topic: Vx-rexx container  (Read 3792 times)

Per E. Johannessen

  • Sr. Member
  • ****
  • Posts: 251
  • Karma: +3/-0
    • View Profile
Vx-rexx container
« on: December 11, 2016, 09:14:29 pm »
I have a container object with several columns and I need to sum the values of one column for displaying the sum in
a field outside the container, each time a record is entered.

ok = VRMethod( "QRY_AVR", "MoveFirst" )
do while( ok = 1 )
    call VRMethod "QRY_AVR", "RowData", "data."
    str = ""
    do i = 1 to data.0
        str = str data.i
    end
    say str
    ok = VRMethod( "QRY_AVR", "MoveNext" )
end

With 2 records the output of say is (from data.1 incl. data.7):

 555 1230 1111 TEST1 1.0  10500 35880
 555 1230 8951 TEST2 1.0  -3456 -8951

The last column, data.7, contains the numbers I need the sum of.
Now the problem is how to make the sum of data.7 and make it available for displaying in a field.

Ideas are welcome and appreciated.

Per E. Johannessen

  • Sr. Member
  • ****
  • Posts: 251
  • Karma: +3/-0
    • View Profile
Re: Vx-rexx container
« Reply #1 on: December 12, 2016, 12:50:58 pm »
Good help from LesK (comp.lang.rexx) solved the problem;

sum = 0

and adding in the loop

parse var data.7
sum = sum + data.7

results in correct output.