OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Per E. Johannessen on October 08, 2020, 07:39:37 pm

Title: VX-Rexx container - get values
Post by: Per E. Johannessen on October 08, 2020, 07:39:37 pm
Hi,

I have a VX-Rexx project with a container filled with values from a query named "QRY_AVR".
The container has 4 columns and 4 records:

----------------------
|AAAA|BBBB|CCCC|DDDD |
----------------------
|   1|2004|  10|35490|
|   1|2004|  12|  732|
|   1|2004|  50|-8150|
|   1|2004|  99|-7320|
----------------------


The code below returns the sum of column "DDDD" (20752):

sum = 0

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

However, sometimes I need to get a specific value from the container.
Let's say I need the value in "DDDD" which corresponds to to the value "12" in "CCCC",
anyone knows how to do that?

(I can get the needed values using several queries, but prefer some rexx-code to do the job.)