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.

Using variables across files

Featured Replies

My apologies to everyone if this has already been discussed.

I want to use a variable across two different FM8.5 files - File A (holding school pupil contact info) and File B (holding invoices / accounts). The files are separate (and not tables within the same file) for a good reason and I don't wish to alter that. The files are related remotely however - the pupil ID being the 'key'.

I want to pick up the pupil ID (the key) in File A and place it into an invoice layout in File B. I currently have a script in File A that contains a subscript. The main script sets the variable (the ID field in the Teaching file) - the sub script opens the File B, goes to the invoice layout, creates a new record and attempts (but fails) to pick up the variable and place it into the ID field, thereby triggering a lookup.

I have spent many hours and read through many of the posts on this excellent forum but am still wondering if there's a smart work-around. Yesterday, glancing through the Scott Love / Steve Lane book, I read that there is a little-known trick using the 'evaluate / get' functions. Unfortunately, this still doesn't make much sense to me and I wondered if anyone out there had used this and knew how the script(s) would need to run.

Many thanks in advance.

Variables are file-specific. Either use global fields or pass values in script parameters. In this case, I'd recommend passing the ID in a script parameter to the sub-script in the second file. Then pull it out in the sub-script using get(scriptparameter).

  • Author

Thanks Ender - I'll give that a try.

  • Author

Hi Ender

Being very much a newbie where scripting is concerned, I have tried the following to no avail - can you spot where my error is in here:

Set variable [$$ID no;Value:Teaching::ID_no]

Open file ["Accounts"]

Perform script ["Create Teaching invoice from file: "Accounts"]

Exit script [Result: Get (ScriptParameter)]

The sub script runs as follows:

Go to layout ["Teaching invoice" (AM_Invoices)]

New record/request

Set Field [AM_Invoices::ID_no; Get (ScriptParameter)]

I have tried Get (Script result) in the subscript but this seemed to make no difference.

Any suggestions would be gratefully received. Thanks

You have to explicitly specify the script parameter in the Perform Script[] step. Look at the bottom of the Specify dialog for the Perform Script[] step.

You might also check out the script parameter description in the application help.

  • Author

Ta da! It works - thanks Enders!

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.