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.

Copying parent record and associated child records

Featured Replies

Hello, I am using a template adapted from the starter solutions (Event Managerment) on FMP 11. I need to copy an event and its guests (the users call them participants). The script is working fine for this purpose; however, I need to also copy the Participant Type for each guest.

The script uses a global field to collect the contact ID's, event contact ID's and the Participant Types. Then it creates a new event record and uses a utility layout to create the new records.

In order to move a blank into the value that's been used, I do this:

Set Field [g_ParticipantType; Substitute (g_ParticipantType; Right (g_ParticipantType; 1); "")]

This is where the problem is occurring. I have tried both the RightWords and the Right function. The same thing happens each time.

After each contact ID has been used to create the new record, I am using the same logic to insert the "M" or "P" participant type and it does great at collecting the values, but the line of script that moves a blank into the global field as each value is used insists on removing 2 values instead of 1. This is the exact logic that I'm using to copy the contact IDs and they are working fine.

I have been working on this for days and searched the forum for a similar problem, but can't find it. My goal was to get this working for participants with a Participant Type and then try to think of a way to deal with blank values, which are possible, but I can't get beyond the 'simple' issue.

Thank you for any suggestions!

  • Author

Hello EOS,

Thank you for your prompt reponse. I've downloaded your file and I am unable to make the script work--I get messages that the file is not modifiable. Also, I don't have access to the script. Is it possible to allow me access?

Thank you so much for doing this work!

Debbie

Hi Deb,

the file is not password-protected, or rather, it uses the default "Admin" account with a blank password.

This sounds more like a problem with your Windows file system permissions, meaning you have to select the file in the Explorer and give yourself write access. (I'm a Mac user, so I can't give you any specifics.)

Oliver

  • Author

Dear Oliver,

Brilliant work! You attacked it completely differently and it's much more simple. And I love the extra features of event copy status and the addition of "copy" to the event description.

I do have multiple users, however. Are you thinking I need to add Allow User Abort Off? Or an error capture series of scripts?

BTW, I was able to open the file only after saving it.

Thank you, thank you, thank you!

Deb

I do have multiple users, however. Are you thinking I need to add Allow User Abort Off? Or an error capture series of scripts?

You're welcome. Glad you like it.

Allow User Abort [Off] sounds like a good idea; you don't want your users marooned on an unknown layout and with only half the job done (I know from experience …).

As for error capture: the basic havoc prevention is the check on existing join records. It still might make sense to throw in some Open Record / Get ( Last error ) combos and, if necessary, roll back the entire process and tell the user to try again later.

  • Author

Excellent, thank you again! You've taught me some great logic!

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.