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.

SMGetVariable ( name )

Featured Replies

Hi all

I am switching from plain Java to Groovy, and I want to start using output variables ( SMGetVariable ( name ) ).

However there is something I don't really grab. To declare a variable in Groovy I use the "def" statement, however when I use this "def" statement, this variable cannot be read by the SMGetVariable ( name ) function.

For example:


def number1 = input1;

def number2 = input2;



def output1 = number1 + number2



Will return "ERROR" when I evaluate the function SMGetVariable ( "output1" ).



However the following lines of code, I am able to get the value of output1.





def number1 = input1;

def number2 = input2;



output1 = number1 + number2;

So I have the feeling that variables you want to get back to FileMaker should be declared differently. Can someone give me some background on why and how?

Thanks in advance!

Andries

  • Author

I think I found the answer, or at least this is what I hope for.

When you declare an object (and not a variable ! ! !) with the use of "def" you define it to exists in the local scope of the script, when you don't declare it. By not declaring the object you actually adds it to the Binding and my guess is that ScriptMaster is looking there for the variables.

Is this correct? Does this also implies that if you omit the "def" it is always a String?

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.