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

Portal records don't copy when I duplicate the record


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

Recommended Posts

Posted

I want to duplicate a record that has portal records on the layout. Only the main record duplicated, the related portal records did not duplicate. :bang:

I can understand why, but why isn't there a function or script step that lets me include the related portal records too? Perhaps a person more familiar with portals and FMP8 has accomplished this already. :help:

The main record and the portal are related using a primary key and foreign key relationship using just one unique field that is serialized.

Posted

Hi, igerton!

You can write script for dublicating record with his portal.

In your case, when you duplicate record, changes the relation fields and ofcouse you can not see portal for duplicated record.

Posted

Maybe a little confusing but the portal records showing for the current record will show for an exact duplicate of the current record. This is because the field values pointing the relationship to the portal records are exactly duplicated and you have gone from a one to many relationship to a many to many relationship.

enthusiast is correct. If you want to create a new set of records in a one to many relationship that is exactly analagous to what you had with the original record and its portal records, you can create a script that isolates the portal records you want to duplicate: create new and unique value or values in a field or fields that will point to the duplicated portal records.

As each portal record is duplicated, it must be edited so its field or fields comprising the relationship target contain the value or values (to be) assigned to pointing field or fields in the duplicate of the original pointing record.

I say field or fields for both the pointing and targeting values in the relationship because FileMaker Pro 8 allows complex relationships and can facilitate creating duplicate portal records under in a special relationship just for creating duplicates where only one value is changed among all the fields in the record to be duplicated -- such as the Record ID for the pointing record. All the rest of the fields can be part of the creating relationship. This method automatically duplicates all data when new a Record ID is assigned by the creating relationship.

What version of FileMaker are you using?

Posted

BFrost,

I am using FMP8 Advanced. Would you be able to explain a little more about the complex relationship used to create the duplicate portal records?

Posted

BFrost,

I am using FMP8 Advanced. Would you be able to explain a little more about the complex relationship used to create the duplicate portal records?

I'll give it a shot.

First, I'll use an example with two tables. One table (Aiming Table) will contain the record that has portal records in the other table (Target Table). The exercise is to duplicate a record in the Aiming Table and to duplicate corresponding related Target Table records so they are targeted only by the duplicate aiming table record in a one to many relationship.

Let's assume that Aiming Table records point to Target Table records based solely on the unique record number in Aiming Table records. That is, a portal associated with an Aiming Table record would show only those Target Table records with the Aiming Table record's unique record number in the target record's target field.

That's the overall relationship for viewing and it also could be enabled to create subrecords in the Target Table, if you want.

Now, forget the Aiming Table for a moment.

In the Target Table create a self-join relationship that involves:

  • Field to same-field relationships for each datum to be duplicated,
  • Global Number field to Target Number Field to be used by the Aiming Table duplicate record.

Enable create new records for this relationship.

Now, back to the Aiming Table. Create a script to:

  • Isolate the record to be duplicated and duplicate it.
  • Set the Global Number field in the Target Table to the unique record number from the duplicate record.
  • Return to the original aiming record.
  • Go to (show only) related records from the original Aiming Table record portal.
  • Invoke a looping script that starts with the first related record to set a value in any field in the self join that's not involved in the creation relationship to any value you want. I often use someting like, "Set field Dupe::Account to Get ( AccountName )." The duplicate records have been created but are not visible during the process.
  • Exit the loop after the last record.
  • If you want, create a relationship between the Global Number field in the Target Records table and Record Number in the Aiming Records table and us it to return to the new aiming record (Go to Related Record) for proofing.

I think that's it. Let me know if I can clear something up for you.

HTH

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