1 Reply Latest reply on Apr 10, 2014 1:36 PM by erolst

    Automatically copy and create join records via a portal?

    user13613

      I'm trying to use one type of table as a template for another type of table.

      For simplied example, here are the tables:

      MyBatch

      MyBatchXStaticAttributeA

      MyBatchXStaticAttributeB

      StaticAttributeA

      StaticAttributeB

       

      MyBatchXItems

      MyItems

      ItemsXStaticAttributeA

      ItemsXStaticAttributeB

       

      A Batch is used to group serveral items. I'd like to the Batches relationships to Attributes A and B as a template for newly created items. Basically each different batch should have it's own unique configuration and when an item is created that is related to that batch, I want all that batch's attributes copied over to the new item(this will be used as a default setting for items).

       

      I have a layout which uses MyBatch as the base table. In this layout I have a portal for my related Items. I can create a item via the portal but it will not have any join table records created (as is normal). How can I create joins table records for my item records which will copy the batch's information at the time of item creation?

        • 1. Re: Automatically copy and create join records via a portal?
          erolst

          If your attributes are only slightly different, you would (probably) be better off by putting them into a single table and distinguishing them by category.

           

          As to your original question: use a script to read in a list of appropriate attribute IDs (as per BatchType) and capture the current batchID, using variables for both. Create the join table records within a loop by setting the batch foreign key to the current batch ID, and get the attribute foreign key from the ID list, using an iteration counter.

           

          Note that this method of creation has nothing to do per se with a portal, which is a means of display.