Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi,

I have two files related - one to many.

The master can see all its children via a portal.

At present, to create a child record I type into a field in the portal and this creates the child-parent relationship, I can then go to the related child and carry on adding data. This is not ideal, I would rather have a button in the parent above the portal which can be selected and thus creates a child relating correctly to the parent.

What's the best way to do this please? - 2 scripts?

Step-by-step answers please as I'm not quiet used to the FileMaker lexicon.

This site is good.

J.

Posted

Basically, you need to copy the field in the parent file on which the relationship is based, then go to the child file, create a new record, and paste the copied value into the correct field.

I suggest creating a global field in the child file. Then create a script in the child file that creates a new record and sets the related field to the contents of the global field. Now create a script in the parent file that sets the related global field to the contents of the related field in the parent file, and then performs the external script. That oughta do it.

Note: There are several other ways to do this, as other people on this forum will no doubt tell you. Take a look at all of 'em.

Posted

Hi,

"I would rather have a button in the parent above the portal which can be selected and thus creates a child relating correctly to the parent."

Keeping the button Idea, and your current settings....

1. Create a fied you'll call "TemporaryKey" (text, num, or global).

2. Create a relationship from the "TemporaryKey" in Master to the field "Record_ID" in the related file. Call it "TempRel"

Note that we are talking about the Record_ID (eventuelly serial num), not the Foreign key from which you established your relationship for the portal.

3. Create a new layout with :

- a small sized portal (width - may be 2 main fields in it), and include in the right side of the portal row (in the portal) a button.

- all the related fields coming from relationship TemporaryKey::Record_ID that you wish to fill in when creating a related record.

4. Attach this script to the button :

Go to related records (TempRel)

---- > Perform External script : Set Field (g_temp, Record_ID)

Set Field (TemporaryKey, g_temp)

5. Now fill in the fields you want as if you were in the related file.

As I said, you could either use a text, number or global field for that. I'd prefer using a text/num as each temporary key would be different if you browse from record to record while being in the Master file.

When using a text/num fied, moving to next record would leave the related fields for that other record empty.

Hope this is clear and makes sense.

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