Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6006 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

I want to know if anyone has done this and how. Here's the situation, you want to create a global var on the fly. You don't know the name or value until you instantiate it.

I was trying to create a script that would allow me to create a named var on the fly rather than explicitly naming it.

My first attempt

Let ( [

expression = "Let ( "$$" & myvar = myvalue" 

] ; 

Evaluate ( expression )

)
 results in an error because you cannot concatenate the name value in the LET statement. 

Second attempt 
Let ( [

var = "$$" & "myvar" ;

val = myvalue ] ; 

Evaluate ( var = val )

)

returns zero and no global variable created.

Edited by Guest
Posted

I don't quite see the purpose of this, but if you want it, you need to correct your first attempt so that the expression is (a) a valid text string and (:) a valid expression:


Let ( [

expression = "Let ( $$" & myvar & " = " & myvalue & "; 0 )" 

] ; 

Evaluate ( expression )

)

This is assuming that the variables 'myvar' and 'myValue' have been defined and are available to the main formula.

Posted

That still did not work UNTIL I quoted the value. Thanks a million. You may not see it's purpose now but perhaps somewhere you'll want to declare a variable on the fly.


Let ( [

expression = 

   "Let ( $$" & $myvar & " = " & Quote ( $myval )  & "; 0 )" ] ; 

Evaluate ( expression ))

And yes your assumptions are correct.

This topic is 6006 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.