Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

The variable $$variable

Featured Replies

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

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.

  • Author

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.

That still did not work UNTIL I quoted the value.

Ah, sorry about that - I used a numerical value in my test, so it slipped by.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.