1

Is there a way to dynamically reference a variable? Apparently value() does not work on a variable reference.

def var export-columns as char extent.
def var i as int.

def var my-columns as char extent ["column1, column2"].

export-columns = value("my-columns").

do i = 1 to extent(export-columns):
  put export-columns[i].
end.
jpfuentes2
  • 2,085
  • 1
  • 18
  • 19
  • What is your ultimate goal? Tim has answered the question that you asked but the code above looks very confused and leaves me wondering if you might be trying to do something which might be quite easy but has nothing to do with VALUE(). (A new question might be appropriate.) – Tom Bascom Nov 15 '11 at 19:50
  • Tom, I appreciate the follow up. I knew of other ways to achieve what I wanted and so I used another solution. The above example is quasi-contrived as I simply wanted to know if dynamic variable references are possible in 4GL and so I don't need assistance with the programming. Thanks. – jpfuentes2 Nov 16 '11 at 15:23

1 Answers1

4

The only way to dynamically access variables is if they're in a temp-table. local variables cannot be accessed dynamically.

Tim Kuehn
  • 3,201
  • 1
  • 17
  • 23