I recently attended a PauseOnError session by Danny Mack on leveraging FileMaker internal IDs. This blog post will demonstrate the method he showed to copy portals for use in a different context with minimal work.
Traditionally, when you copy a portal to a layout that has a different context, you need to redefine the copied portal, its fields, and other things like conditional formatting. This technique eliminates much of this work. I have attached a sample file so that you can try out the technique for yourself in a simple way.
The sample file copy_portal.fp7 has three tables: Parent_One, Parent_Two, and Child.
Step 1: Copy the portal Child__original_context to clipboard
Step 2: Enter relationship graph and duplicate the Child__original_context table occurrence. You will notice the duplicated table occurrence now has a number 2 following its name.
Step 3: Establish the relationship from Child__original_context 2 to the table occurrence Parent_two
Step 4: Rename the table occurrence Child__original_context to Child__original_contextx.
Step 5: Rename the duplicated table occurrence to Child__original_context
Step 6: Go to layout Parent_two and paste the portal that you copied to the clipboard in step one onto the layout. You will see the correct context for the portal and the field it contains. When you enter browse mode, the correct data will be displayed.
Step 7: Go back into the relationship graph and rename the table occurrence Child__original_context to Child__original_new_context. Then rename the table occurrence Child__original_contextx back to Child__original_context.
Step 8: Click ok and you have successfully copied a portal to its new context and retured everything else back to its original state.
Using this time-saving technique the other day, I copied 25 table occurrences, their established relationships, several portals (in one copy), and a lot of conditional formatting all using the same steps above. You can imagine how much time that saved!
If you have found this technique helpful or have any tips or suggestions to make it better, please leave a comment.