5 Replies Latest reply on Feb 6, 2014 9:27 AM by philmodjunk

    Adding to a field the contents of portal rows consecutively

    NaturSalus

      Title

      Adding to a field the contents of portal rows consecutively

      Post

           Hello,

           What I would like to do is to be able to click on the desired rows of a portal and add consecutively their contents to a file.

           So, let's assume that I have the following portal with contents in 7 rows.

           Row 1:  1 1/2 cups all-purpose flour

      Row 2: 2 1/4 cups old-fashioned oats 

      Rwo 3: 1 1/2 teaspoons ground cinnamon

      Row 4: 3/4 teaspoon baking soda

      Row 5: 1/2  teaspoon salt

      Row 6: 1 cup granulated sugar

      Row 7: 2 large eggs

           Now, I would like to be able to:

           a) either adding the contents of the portal to the Cook::Recipe field

           b) or being able to click in each portal row so that the contents are added to the Cook::Recipe field.

           whatever it is easier to set up.

           Can this be done by scripting?

           The usual way to add just the content of a portal row to a field is using the Set Field, List and Substitute script steps

           Set Field [Cook::Recipe; Substitute(List Portal::Amount; Portal::Unit; Ingredient::iName); ¶ ; " ")

           but every time that the Set Field script step is run it overwrites the Cook::Recipe field.

            

           Thanks

            

            

        • 1. Re: Adding to a field the contents of portal rows consecutively
          philmodjunk

               Set Field [Cook::Recipe; Substitute(List Portal::Amount; Portal::Unit; Ingredient::iName); ¶ ; " ")

               will work for A) but not B).

               Try this code to append the data to data already present in the field:

               Set Field [Cook::Recipe; Cook::Recipe & " " & Substitute(List Portal::Amount; Portal::Unit; Ingredient::iName); ¶ ; " ")

               Though I question the utility of doing so here....

          • 2. Re: Adding to a field the contents of portal rows consecutively
            NaturSalus

                 Helo Phil,

                 Thanks for looking into my question.

            Set Field [Cook::Recipe; Substitute(List Portal::Amount; Portal::Unit; Ingredient::iName); ¶ ; " ")
                  
            will work for A) but not B).
                  
                 I must be doing something wrong, because when I run the above mentioned script step it just adds the last portal row, not the contents of all the portal rows.
                  
                 That is the reason why I asked for help about how to append data into a field.
            • 3. Re: Adding to a field the contents of portal rows consecutively
              philmodjunk

                   I misread your post. It should be:

                   Substitute ( List ( RelatedTable::SingleFIeld ); ¶ ; " ")

                   and then it will work for A). The key is that "single field" looks like it needs to be a calculation field to combine the values of Amount, Unit and iName.

                   Since all three fields come from different table occurrences, the relationships between List Portal, Portal and Ingredient could also keep this from working as expected.

                   ExecuteSQL could also produce the desired result and it would not need an added calculation field to do so.

              • 4. Re: Adding to a field the contents of portal rows consecutively
                NaturSalus

                     Hello Phil,

                     Your script

                Try this code to append the data to data already present in the field:

                Set Field [Cook::Recipe; Cook::Recipe & " " & Substitute(List Portal::Amount; Portal::Unit; Ingredient::iName); ¶ ; " ")

                     works quite well. To get the desired results I put ¶ instead of " " , and bingo!

                     Many thanks

                • 5. Re: Adding to a field the contents of portal rows consecutively
                  philmodjunk

                       works quite well. To get the desired results I put ¶ instead of " " , and bingo!

                  Then you can simplify it by removing the substitute function from this calculation. List puts ¶ between each value to begin with.

                       But how will you use this text in the first place? It seems an unnecessary calculation.