Like dynamic-function , cane we create

Like dynamic function is there any method to create variable whose name is value of another variable.

eg. I have to do like this..
is it possible ?

define variable m_var as character init "new_var".

define variable string(m_var) as integer.
 
The short answer is no, unless you have development license.
With development license you can compile on the fly, then it is possible:

first procedure which runs the procedure with the dynamic variablename decleration:
Code:
DEFINE VARIABLE cTst AS CHARACTER  NO-UNDO.
ASSIGN cTst = "cParam".
RUN test.p VALUE(cTst).

test.p (this will only compile on the fly, so needs to be a .p):
Code:
DEFINE VARIABLE {1} AS CHARACTER NO-UNDO.
ASSIGN {1} = 'ttt'.
MESSAGE {1}
    VIEW-AS ALERT-BOX INFO BUTTONS OK.

In a runtime environment:
Variables have to be known at compile time so there is no way to achive this dynamically.
What do you try to acomplish with this? I mean what's in a name :awink:

HTH,

Casper.
 
DEFINE VARIABLE {1} AS CHARACTER NO-UNDO.
ASSIGN {1} = 'ttt'.
MESSAGE {1}
VIEW-AS ALERT-BOX INFO BUTTONS OK.

this cod will not work in
PROGRESS Procedure Editor
Version 9.1D09 │
POSSE Version 2.0
 
Yep it does :-)

Like I said, It compiles only on the fly...

So you have to run the first procedure:
test.p must be in the propath.

Code:
DEFINE VARIABLE cTst AS CHARACTER  NO-UNDO.
ASSIGN cTst = "cParam".
RUN test.p VALUE(cTst).

Tested this on 9.1d06 and 10.1B01.

Casper.
 
Back
Top