5 Replies Latest reply on Apr 20, 2016 3:31 PM by realgrouchy

    Auto/Bulk updating references to child table fields (instances)

    realgrouchy

      I have a portal showing records from Child Table 2 with a bunch of fields from Child Table 2.

       

      I want to use this portal on a different layout, but on that layout I want the portal to refer to Child Table 3.

       

      Is there any way to get the fields to update automatically, or to update them all in one go, when I change the portal from Child Table 2 to Child Table 3? It's frustrating to have to individually select every field and update every single instance.

       

      On top of that, I also have to update references to the tables in hide settings, conditional formatting formulae, etc.

       

      I'm guessing there's no easy way of doing this but thought I'd ask anyway just in case...

       

      - RG>

        • 1. Re: Auto/Bulk updating references to child table fields (instances)
          bigtom

          Ssounds like a manual operation unless you build some sort of field abstraction system.

          • 2. Re: Auto/Bulk updating references to child table fields (instances)
            designr

            You can but it's tricky. DO NOT DO THIS ON ORIGINAL COPIES. EXPERIMENT WITH TWO COPIES FIRST.

             

            ASSUMING:

            1. All the fields in "Child Table 2" have the same names as all the fields in "Child Table 3".

             

            YOU MAY:

            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.

             

            Good luck.

            • 3. Re: Auto/Bulk updating references to child table fields (instances)
              bigtom

              Interesting.

               

              It would be nice to have an option to bulk change the TO name though. Submit to the Ideas section?

              • 4. Re: Auto/Bulk updating references to child table fields (instances)
                keywords

                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.

                • 5. Re: Auto/Bulk updating references to child table fields (instances)
                  realgrouchy

                  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.

                   

                  Thanks again.

                   

                  - RG>