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

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

Recommended Posts

Posted

 

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

Important Information

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