Jump to content

Copying parent record and associated child records


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

Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 4265 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.