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.

Check Variables for Let

Featured Replies

 

CheckVariables.png

As you may know we have a variable check for FileMaker script workspace for macOS in MBS FileMaker Plugin. This works fine for most scripts, but you may need to know a few pitfalls. Since the plugin reads what is in the script workspace window and FileMaker truncates long lines, it will not catch a variable mistyped in a very long line. When we read a calculation like this one:

Let([
	// define some variables
	$varDefined = 1; $secondVarDefined = 2]; $varDefined) 

The plugin sees it as

Let([	// define some variables $varDefined = 1; $secondVarDefined = 2]; $varDefined) 

We don't get line breaks, so we have no idea where the comment ends and thus we can't find mistyped variable there.

 

There has been a problem that not scanning Let() for variable definitions, we now allow you to add a comment in front of the Let() or custom function call to define the variables: Start with a // comment and add they keywords @variable, @parameter or @constant (or shorter @var, @param or @const), then add a new line and continue with the calculation.

comment and add they keywords @variable, @parameter or @constant (or shorter @var, @param or @const), then add a new line and continue with the calculation.

e.g.

// @var $varDefined, $secondVarDefined
Let([
// define some variables
$varDefined = 1; $secondVarDefined = 2]; $varDefined) ] 
 
The plugin will recognize the comment and accept the variable even as we can't parse the Let statement due to missing line breaks.
 
Here is a test script showing various checking situations.
 
# you define a variable regularly
Set Variable [ $var1 ; Value: 1 ] 
# and use it
Set Variable [ $var2 ; Value: $var1 + 1 ] 
# now we define one via comment in Let()
Set Variable [ $test ; Value: 
	// @var $varDefined, $secondVarDefined
	Let([
	// define some variables
	$varDefined = 1; $secondVarDefined = 2]; $varDefined) ] 
# or here in a comment line to define a variable set by custom function:
# @var $thirdVarDefined
Set Variable [ $test ; Value: SomeCustomFunction ] 
# or now with comment inline:
Set Variable [ $test ; Value: 
	// @var $thirdVarDefined
	SomeCustomFunction ] 
# and use them
Set Variable [ $r ; Value: $varDefined + $secondVarDefined + $thirdVarDefined ] 
# If you don't declare it, we may catch it as an error:
Set Variable [ $test ; Value: Let([$NotDefined = 1]; 1) ] 
Set Variable [ $test ; Value: $testing + 1 ] 
# and this includes using an accent, which gives a different name:
Set Variable [ $test ; Value: $varDefíned + 1 ] 

Please try MBS FileMaker Plugin 13.5 pre-release to try this and let us know if you find a problem or just like this new feature.

Create an account or sign in to comment

Important Information

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

Account

Navigation

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.