selectuniverse

Universe basic convert a select list to an array?


I have one major select list in a program

EXECUTE 'SELECT PRODUCTS WITH DEL.DATE <= "':EOM.DATE;'"' CAPTURING OUTPUT

I then want to covert the select list to an array, is there a Universe basic function to do this or do I need to write a function?


Solution

  • Use READLIST to read the contents of your active select list into a field delimited (@FM) dynamic array. This is a paradigm I employ when working with multiple select lists and the payloads aren't too large. You can also select into a different list other than the default of 0 but that gets a bit messy intellectually.

    EXECUTE 'SELECT PRODUCTS WITH DEL.DATE <= "':EOM.DATE;'"' CAPTURING OUTPUT
    READLIST PRODUCTS.LIST ELSE PRODUCTS.LIST = ''
    PRODUCTS.COUNT = DCOUNT(PRODUCTS.LIST,@FM)
    FOR X=1 TO PRODUCTS.COUNT
       ID.PRODUCTS = PRODUCTS.LIST<X>
       ;* Your per ID magic goes here
    NEXT X
    

    Good luck!