10 Replies Latest reply on Jun 8, 2017 6:30 AM by Wicktor

    Passing content of container repeating field into an other field

    Wicktor

      Hello everyone,

      I have Table_A with container fields Field_1, Field_2, etc, (each with 2 repetitions).

      In a layout I have all those fields with a script trigger "OnObjectEnter"

      When I click on one of those fields I need to pass the specific content into an other container Field_B (with 2 repetitions)

      Its suggested in an other thread I tried as follows:

      Set Variable [ $fn ; Get ( LayoutTableName ) & "::"& Get ( ActiveFieldName ) ]

      Set Field [ Field_B ; GetField ( $fn ) ]

      Set Field [ Field_B [ 2 ] ; GetRepetition ( GetField ( $fn ) ; 2 )

       

      It does not work.

      Any clue ?

      Many Thanks,

      Victor

        • 1. Re: Passing content of container repeating field into an other field
          keywords

          As I understand it, the field you are using to set the variable is itself a repeating field. If that is the case you will need to capture the active repetition i  your variable as well as the field name.

          • 2. Re: Passing content of container repeating field into an other field
            erolst

            What I don't fully understand:

             

            Is the entire field (incl. all repetitions) to be transferred to the source, or just the clicked-into repetition into its target counterpart repetition?

            • 3. Re: Passing content of container repeating field into an other field
              philmodjunk

              And what you describe in terms of fields and repetitions calls into question as to whether you basic set up is really ideal in the first place.

               

              I am basing that on very limited info, but:

               

              I have Table_A with container fields Field_1, Field_2, etc,

              Suggests a less than optimum data model.

              • 4. Re: Passing content of container repeating field into an other field
                Wicktor

                Hi all,

                Table_A has only one record with a fixed limited number of containers fields with images (16 fields to be exactly). The decision of using Field_1, Field_2....FIeld 16 was made since it is a static Table with no need to add more images and/or records. Each field as 2 repetitions (since they contain stereoscopic images).

                 

                In other Tables/Layouts the user will need to choose one of those 16 fields to be used in calculations.

                 

                For now I changed the original formulas and solved as follows:

                A OnObjectEnetr trigger on each of those 16 fields calls the followings script

                Set Variable [ $fn ; Get ( LayoutTableName ) & "::"& Get ( ActiveFieldName ) ]

                Set Field [ TableB::Field_B ; GetRepetition (Evaluate ( $fn ) ; 1)]

                Set Field [ TableB::Field_B [ 2 ] ; GetRepetition (Evaluate ( $fn ) ; 2)]

                 

                That way it works.

                Open to suggestions,

                 

                Thank you,

                Victor

                 

                1 of 1 people found this helpful
                • 5. Re: Passing content of container repeating field into an other field
                  keywords

                  Wicktor wrote:

                  The decision of using Field_1, Field_2....FIeld 16 was made since …

                  I am surprised to read that this was a decision. Usually that kind of field naming comes about by non-decision. It would be a good idea to at the very least name these fields in a way that gives some sort of pointer to what they contain. You may not need to change them or add to them but you do need to interact with them. What clue is there to indicate any difference between the content of Field_1 and Field_12? Absolutely none. Compare that to fields named Size, Colour, Age, Height …

                  • 6. Re: Passing content of container repeating field into an other field
                    philmodjunk

                    The main draw back to your current design is a distinct lack of flexibility. If the need arises for more fields, you have to go in as a developer and add them.

                     

                    If, on the other hand, you set up a series of records with one container field to a record, a need for an increased number of such fields is mainly a data entry task met by by creating more records.

                    • 7. Re: Passing content of container repeating field into an other field
                      erolst

                      philmodjunk wrote:

                       

                      The main draw back to your current design is a distinct lack of flexibility. If the need arises for more fields, you have to go in as a developer and add them.

                      ..  and then explicitly adjust everything that deals with that set of fields to the new field count. On the other hand, functions, scripts and other features that are based on record sets are agnostic to the actual size of that set.

                      • 8. Re: Passing content of container repeating field into an other field
                        Wicktor

                        Many Thanks for all comments,

                         

                        Let me give some details (that are outside my original question) and I guess the situation is less dramatic as it would appear.

                        The solution is for educational/testing purposes with 16 situations of 3 levels of difficulty each (described below).

                         

                        In the solution there are:

                         

                        1) TABLE_IMAGES with 4 fields: TITLE (text), PICTURE (Container, 2 repetitions), DESCRIPTION (text), DIFFICULTY (text). This Table has a layout where the Administrator may add as many records with pictures as desired. He will tag each image with one of the 3 DIFFICULTY level (see below).

                         

                        2) TABLE_CHOICES (mentioned as Table_A in my original question) with 16 fields IMAGE_ 1, IMAGE_2.... IMAGE_16 (Containers, 2 repetition) and USERNAME (text).

                        It has one record for each User.

                        This Table has a layout with DIFFICULTY buttons (easy, intermediate, advanced). The Administrator clicks on one of the 3 buttons and the solution randomly choose images accordingly with DIFFICULTY from the TABLE_IMAGES and copy those images into the 16 container fields.

                        The reason of using this intermediate table is that it stores the images selected for that specific User and then its viewing experience can continue when he/she re-logs again. Also it stores the time and the results for each image. Otherwise I would just pull the randomly selected images into TABLE_USER (see next).

                         

                        3) TABLE USER (mentioned as Table_B in my original question) with USERNAME (text) USERPASSWORD (text), VIEW_IMAGE (a temporary global container, 2 repetitions) and other text fields.

                        It has one record for each User.

                        This Table has various layouts where the User can click on one of those 16 specific image getting various kinds of viewing situations of the images. As I mentioned, images are stereoscopic and other various fields can change various skills needed for proper viewing including hidden stereo objects.

                         

                        The Users will go thought the 16 images of easier difficulty and after completing the task, the Administrator will generate a more difficult level (easy, intermediate, advanced).

                         

                        I think I can convert the TABLE_CHOICES using 16 records instead of 1 record with 16 fields, but I think (I might be wrong) it is not critical, since it is a static Table where there is no need for additional records and/or images.

                         

                        My problem (my original question) was to to pass the selected image into the VIEW_IMAGE field which shows the images full screen.

                        I used the script as mentioned before:

                        A OnObjectEnetr trigger on each of those 16 fields calls the followings script

                        Set Variable [ $fn ; Get ( LayoutTableName ) & "::"& Get ( ActiveFieldName ) ]

                        Set Field [ TableB::Field_B ; GetRepetition (Evaluate ( $fn ) ; 1)]

                        Set Field [ TableB::Field_B [ 2 ] ; GetRepetition (Evaluate ( $fn ) ; 2)]

                         

                        It works, I hope it is the best way to do it.

                         

                        How does everything sounds ?

                         

                        Always open for suggestion,

                        Many Thanks,

                        Victor

                        1 of 1 people found this helpful
                        • 9. Re: Passing content of container repeating field into an other field
                          erolst

                          Wicktor wrote:

                          This Table has a layout with DIFFICULTY buttons (easy, intermediate, advanced). The Administrator clicks on one of the 3 buttons and the solution randomly choose images accordingly with DIFFICULTY from the TABLE_IMAGES and copy those images into the 16 container fields.

                          The reason of using this intermediate table is that it stores the images selected for that specific User and then its viewing experience can continue when he/she re-logs again. Also it stores the time and the results for each image. Otherwise I would just pull the randomly selected images into TABLE_USER (see next).

                          The problem with multiple fields that store the same kind of information is two-fold:

                           

                          1) Maintenance

                          - you need to create more more fields to record more instances of that same kind of information

                          - you need to support entire sets of data: image1...16, date1...16, result1...16 ...

                           

                          2) Analysis & Presentation

                          - aggregating a bunch of fields and presenting the results in a dynamic manner becomes difficult, and you often find that you have to employ utility tables with the exact same structure you could have used for your data table in the first place.

                           

                          But if it works, it works. And since you don't use that structure to store data, a later re-design, should it become necessary, won't be a problem.

                          1 of 1 people found this helpful
                          • 10. Re: Passing content of container repeating field into an other field
                            Wicktor

                            It looks only a couple of hours so I changed the original structure creating a new Table with one record for each image and used portals for display them in other layouts.

                            Thanks everyone,

                            Victor

                            1 of 1 people found this helpful