Ssounds like a manual operation unless you build some sort of field abstraction system.
You can but it's tricky. DO NOT DO THIS ON ORIGINAL COPIES. EXPERIMENT WITH TWO COPIES FIRST.
1. All the fields in "Child Table 2" have the same names as all the fields in "Child Table 3".
1. Duplicate your database.
2. Open the duplicate database.
3. Rename "Child Table 3" to "Child Table 3xx" in Relationship Graph (in duplicate database).
4. Rename "Child Table 2" to "Child Table 3" in Relationship Graph (in duplicate database).
5. Copy portal (now pointing to "Child Table 3") from duplicate database to original database.
The newly copied portal should now point to "Child Table 3".
This also works for duplicating layouts if both target tables are exactly the same.
It would be nice to have an option to bulk change the TO name though. Submit to the Ideas section?
At first look, it seemed to me this was simply a case of building a relationship to CT3 and repointing your portal through that, but I'm a bit confused by your description.
If you mean that in Layout mode you want to copy a portal and all of its contents onto a new layout and change the portal settings to a new relationship, then that is easy enough to do, but it is necessary to reassign the portal, then reassign each field, and there is no way to do this is bulk (could be a feature request there). Hiding and CF will also have to be revised, unless they use Self. At this stage there is no other way, but at least you only have to do it once.
OMG that's awesome! Geinus! My initial test seems to suggest that it works! Obviously formulas like If ( Get ( TableName ) = "ChildTable" ) won't change to "ChildTable 2" ) but it definitely cuts down on the gruntwork involved.
Specifically, I did the following:
- Made a duplicate of the database
- Opened the duplicate. In Manage > Database ("Tables" tab), I renamed "Child Table" to "Child Table 2".
(Note: Interestingly, in the relationships graph, after I renamed the table itself, the name of the former table instances "Child Table 2" and "Child Table 3" automatically renamed to "Child Table 2 2" and "Child Table 2 3", however the original table instance "Child Table" retained its initial name in the relationships graph; I renamed it to "Child Table 2". I'll report this separately as a possible bug. I'm sure your way of simply renaming the table instances would also work.)
- Opened the layout with the desired portal in the copy of the database, copied it and pasted it into the original copy of the database, which has a table instance called "Child Table 2".
This will be very handy when I want to update the "notes" module in my database and copy-paste the updated version into different layouts where the notes module refers to different instances of the "notes" table.