Jump to content

Using variables across files


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

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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