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 the copy function within a script

Featured Replies

  • Newbies

Hi All,

I'm new to using FileMaker and am having an issue with a script I'm trying to write.

Basically I've created a many to many relationship using an intermediary table because I need to store some information on the link. The association is between "Shops" and "Parks", with things like the distance between the two stored within the intermediary table.

I was hoping to be able to add a button on the "Shops" page that said something like "Associate with Park". When the button is clicked the "Shop ID" is copied, and the user is taken to a new layout when the "Shop ID" is pasted into the foreign key field there. For some reason this doesn't seem to work, as when I create a new record on the intermediary table the contents of the copy is lost. (I think this is what's happening)

Here is the script in pseudo-code:

Copy [shop::Shop ID]

Go To Layout [shop - Park Association]

New Record/Request

Paste [shop ID]

Go To Field [Park ID] // so the user can now select the park

Using FM7 on OSX.

Any advice would be much appreciated.

Cheers,

Brenton

Copy and paste aren't the best tools to use. I'd recommend using global fields with Set Field[]s instead. You shouldn't be relying on Filemaker's Clipboard if you can help it.

The issue may be with how you're using those functions, so simply adopting that good filemaker practice may solve your issue.

The Copy and Paste script steps only work when the fields are on the current layout when they are called.

Make sure the ShopID field is on the Shop - Park Association layout.

  • Author
  • Newbies

OK, so I've got it working by creating a new table "Temporary" with the global field "Shop ID". I just set that field, then set the Shop ID on the other layout with that value. Is this the best/most correct way of doing this?

The global field could have been in any table, but that's good.

OTOH, if you'd have been using FMP 8.5 or later you could have used a variable to hold the value and done without the global completely.

IMHO it's worth the upgrade to 8.5 (or 9.0) just for variables.

  • Author
  • Newbies

I have to admit that I completely agree with you - this sort of application without being able to use something as simple as variables in scripts is a bit silly. Unfortunately the version of FileMaker being used isn't up to me :-(.

Actually, you could use the script parameter for this.

Actually, you could use the script parameter for this.

:thumbup::thumbup::thumbup:

Most elegant solution!

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.