Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HOW TO reference a function name with variables?
#1
Morning to All!

Here is what I need to do per my macro & exe.
I see that there are problems with: "For example, with mac, if function name is variable, QM cannot know what function will be used, and displays a warning. Then use #exe."
If I need to include a 'function' that is referenced per variables THEN how do you suggest doing this?

Let's say the function is:

function_01_name

and I want to use a variable for the "01"

So I have something like,

mac F"function_{ID}_name"

How do I include this in an 'exe' macro (per "#exe" I guess?) (See my details below per what I tried.)

Thanks for your help & more details below!!!

Kent

*************************************

I am building a 'quasi-object' macro that I can easily instantiate into a new but slightly different macro or function.

For each instantiation of the Macro, the function names will change, for Example:

Macro #1 will have functions named as:
function-1_01
function-2_01

and Macro #2 will have functions named as:
function-1_02
function-2_02

I therefore want to be able to call the functions by using variables, such as:

str var1="_01"
mac F"function-1{var1}"

And call the variable.

How can you call a variable when using variables?

Here is what I resorted to:

str x="Oc_"
str y="_FrMatter_BeforeAll_DialogVARs_PreGlobal"
str nextFUNC=F"{x}{thisID}{y}"
out nextFUNC ;;for testing only
str fn = F"{nextFUNC}";;"MyFunction"
int r
r = call(fn)

Note:
-the function that I want to call is named: Oc_ID_510271_01_FrMatter_BeforeAll_DialogVARs_PreGlobal
-the "ID_510271_01" is what changes when I create a new macro from my object (this is the {thisID} variable above

I have successfully used the form above to call a variable BUT HERE IS THE KICKER, if I export it will not work.
Oh! I just saw the message about 'addfunction'

So, what do you suggest?


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)