Skip 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.

Odd Variable behavior in calc engine

Featured Replies

Okay, Robin, one of my colleagues, pointed this one out to me. I’ve never run across it before, because…because I’m perfect, and never mistype in the calc engine! Yeah…yeah, that’s it.

Anyway, to reproduce:

1.open up the calc engine (Data Viewer will do)

2. Add an expression to the Watch pane, and copy/paste this into the calc dialog:


$test $test

$test $test

$test $test $test

3. Click on Monitor

4. Scratch your head in befuddlement.

You’d think FM would bark once you try to commit this expression, since there aren’t any operators…but no.

I’ve monkeyed with the contents of the variable to see if anything useful can be done with this (i.e. there’s an obscure reason for it), but nope - tried “1 +”, “test &” etc, putting operators in the string to see if something interesting might come of it.

Anyway. Odd. Any ideas or thoughts about this? Am I missing something obvious?

Hi Colin

I think that there is no error because an $var ( and an $$var ) can be named with multiple words.

So:

$test this test <-- legal variable

$test $ test <-- legal variable

$test $test <-- legal variable

Note that the last two variables can be definited in many ways but NOT with Set Variable [ ]

So in your example there is [color:red]ONLY ONE variable and you can SET it for example with a Set Field [ ] script step using the Let ( ) function, something like:

Set Field [ YourTable::YourField ; Let ( [color:red]$$test $test $test = $$test $test $test + 1 ; "" ) ]

Note that I used an [color:red]$$var so you can see easily the result

  • Author

Interesting. Yeah, that works if you use a Let statement in a Set Field script step.

Note that trying to Set Variable "$test $test” to some value in a script step doesn’t work, because it reads the second $ as an illegal character.

This is a bit inconsistent, obviously. Why should the behavior be illegal in one circumstance, and generate NO error in another (and, moreover, WORK)?

Moreover, I find it a bit odd that the calc engine interprets return characters as part of the variable name as well.

I have a feeling something would break somewhere if you were to choose to declare variables with illegal characters through Set Field. I just don’t know where.

Note that trying to Set Variable "$test $test” to some value in a script step doesn’t work, because it reads the second $ as an illegal character

Isn't it the same as:

Note that the last two variables can be definited in many ways but NOT with Set Variable [ ]

Moreover, I find it a bit odd that the calc engine interprets return characters as part of the variable name as well

Try this:


Let([

a = 1 ;

b

a = 2 

 

+ a ];



b

a

)

  • Author

Ow. And this is helpful to my brain at 5 o’clock on a Friday...how?

;-)

And now I have Abacab in my head, and will have to purge it.

  • Author

Yep, I just missed that part of your post.

Edited by Guest

And now I have Abacab in my head, and will have to purge it.

Try with solving this quiz:

What is the result of this calculation ?

( "mission impossible" - "0" - "1" )


Let([

$test $test = 1 ; $test

$test = $test $test - 1

];

$test

$test + $test $test

)

After that quiz, another:

Can exist this variable: $$$ :

( Try a button with this step: )

SetField [ YourField ; Let( $$$ = Abs ( $$$ - 1 ) ; $$$ ) ]

  • Author

This is eerily like those dreams I was having the night before my 11 certification exam.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.