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.

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

Featured Replies

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

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

  • Author

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

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

  • Author

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

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

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.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

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.