2 Replies Latest reply on Jul 17, 2014 7:41 AM by JohnSmith_3

    Moving images in repeating container field to first position

    JohnSmith_3

      Title

      Moving images in repeating container field to first position

      Post

           Hi,

           I have a repeating container field (10x) where my users can insert photos. Sometimes, they have inserted them in the later positions rather than starting from the left at position/field #1.

           Is there any way I could go through all my records, search for photos in the container field, and if they are, move them if necessary in such a way as to make sure they fill up the repeating field starting at position 1?

           Thank you, I can't seem to find anything online related to working with repeating container fields and their contents.

            

        • 1. Re: Moving images in repeating container field to first position
          philmodjunk

               That's because a repeating field is (and should be) rarely used for this. A related table with one record for each image is more flexible and avoids this issue. It's pretty simple to use Import Records to copy this data from the repeating fields into such a table with the data in each repetition split into a separate record. This will then also solve your issue of images not being filled in from the first repetition onwards as any empty repetitions will not produce a record in such a new related table.

               Without such a design change, you are looking at a fairly complex script that loops through the records, and on each record loops through the individual repetitions looking for empty repetitions and using a third loop to move the images from repetition to repetition when an empty rep is found.

          • 2. Re: Moving images in repeating container field to first position
            JohnSmith_3

                 Thank you for the prompt reply. You're right that does sound particularly convoluted, and I should be using portals for this instead.

                 Thanks, I'll make the design change.

                 Keep up the good work Phil, you've always got the solution to all my problems :)