Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Creating one-to-many relationship records – not copying and pasting


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

Recommended Posts

Posted

Hi All

Can any one help?

I have a table, call it vehicle-data, with a one-to-many relationship to service-history.

Vehicle data is about the vehicle, and a new record in service-history is created every time work is done on that vehicle to store the service details.

To create a new service-history record you can use cut and paste via script:

1. Copy vehicle reference number in vehicle-data (the field used to join in the relationship)

2. Open a new record in service-history

3. Paste the data into the new service-history record relationship field

You have now created a new related record for the vehicle ready to enter all the service data.

But by using copy and paste you lose any data on the clipboard that was saved.

I have tried Set Field etc – But can not find a way of doing the above, creating a related record, by not using copy and paste as I need to preserve the clipboard data.

Any ideas?

Matt

Posted

Hi Matt - welcome to FMForums

Steer clear of using Copy/Paste techniques

Here's a solution that uses a combination of portals relationships and global fields.

Incidentally I'm in the market for developing and promoting vertical market systems. Yours might fit the bill.

Motors.fp7.zip

Posted

Mark,

Thanks for the reply.

Yes I want to steer well clear of any cut and paste operation - happy with the use of a portal to create the child record and use it many times.

What I had hoped to do was to create child record with out a portal, as there is no portal on the screen when I need to create the child record.

Guess the 'real' answer is to use a script to freeze screen - move to another screen with a suitable portal - then do the create.

So my real question - Is it possible to crteate a child file without a portal and NOT using cut and paste.

Any guidance would be welcome.

Matt

Posted

Matt,

You can create a related record in the service history table without using a portal or cut and paste. One simply way would be as follows:

1) Make sure you have a layout for the service table TO.

2) Create a script that will simply create a new record as follows:

Freeze Windows

Go To the layout

New Record/Request

Set Field (Vehicle key field, get(scriptparameter)

go to layout(original layout)

3) Call this script passing it the vehicle key field as a parameter.

4) Done

Hope this helps

Echo

Posted

Echo,

I must be having a really bad day .... sorry!

Can you explain:

1) Make sure you have a layout for the service table TO. ..... the 'TO'

How does this script 'know' the vehicle-key reference prior to posting in the new record with Set Field (Vehicle key field, get(scriptparameter)

Matt

Posted (edited)

Matt,

TO means Table Occurance in the relationship graph.

Sorry, I should have said "Foreign Vehicle key field" in the set field step. This is the vehicle reference field in the service table. The set field will get the key value from the parameter you pass the script when you call it. When you call the script, simply pass the vehicle key as a parameter.

Echo

Edited by Guest
Posted

In the example I sent you there is a short script that uses a global field to pass the key values around. You can still use that technique without using a portal - just switch between tables/files and do a new record with the key value in the global.

The portal is probably easiest, plus you get a summarised data listing on the primary screen.

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