4 Replies Latest reply on Mar 13, 2014 8:55 AM by philmodjunk

    Adding value to all rows in a portal

      Title

      Adding value to all rows in a portal

      Post

           Hi,

           I have a portal that shows all records with a value in a field, not just equals a field, so I can't do this with table relationships.

           What I want is to be able to add a value to all the rows in a portal.

           At the moment I have a script button on each row and I go down clicking the button and it adds the value to the row.

           When there are 50 or so rows then it becomes time intensive.

           Is there a way to do this.

           The value is a field on the main table and the button adds this value to the row on the portal.

           I could do replace field in table layout view of a group, but I don't want to do it this way if poss.

           Thanks!

            

        • 1. Re: Adding value to all rows in a portal
          philmodjunk

               I have a portal that shows all records with a value in a field, not just equals a field, so I can't do this with table relationships.

               That is not necessarily the case. Keep in mind that your relationship for your portal need not be the only relationship between the layout's and portal's tables.

               Can you describe in more detail what you mean by "add"?  Are you adding a value to whatever value is already in that field? Example: there's a 1 in the field and the parent record has 5 so this process then puts a 6 in that field of that portal record?

          • 2. Re: Adding value to all rows in a portal
            philmodjunk

                 And is this a filtered portal?

            • 3. Re: Adding value to all rows in a portal

                   Thanks Phil,

                   Here's the breakdown of the portal.

                   The portal shows records from the table "people" it is on a layout based on the table "company"

                   The portal shows people that I want to contact.

                   The portal is filtered to only show those people with a "Y" in a field I call "quick tag"

                   The button on each row, when clicked, adds the value from a field "company ID" in the main layout based on the table "company" to a field called "projects" in the record of the row it sits in in the portal.

                   It adds the value on the next line of the field "projects"

                   So if company ID is 33, and the field already has 66 in it, then it goes on the next line, eg

                   66

                   33

                   The script also removes the value Y from quick tabs.

                   Basically I want a button to repeat this action for all rows that show up on the filtered portal.

                   Is it possible?

                    

              • 4. Re: Adding value to all rows in a portal
                philmodjunk

                     In most cases, I would replace your return separated list of values with a join table--it's easier to add and remove records than do "list surgery" to add and remove them from a list.

                     If the relationship used for this portal is a Cartesian join: (Uses the X operator to match to all People records)...

                     Then I might use the following script:

                     Freeze Window
                     Set Variable [$CompanyID ; value: Company::Company ID ]
                Go to Layout [ "People" (People) ]
                     Enter Find Mode []
                     Set Field [ People::Quick Tag ; "y" ]
                     Set Error Capture [on]
                Perform Find []
                     Replace Field Contents [no dialog; People::Projects ; List ( People::Projects ; $CompanyID ) ]
                     Replace Field Contents [no dialog; People::Quick Tag ; "" ]
                     Go to Layout [original layout ]
                      

                     If you are not using a Cartesian join, I'd replace the blue script step with a Go to Related Records step and the green step with a Constrain Found Set step. (And I'd also add code to check for related records before allowing the rest of the script to execute.)

                     PS: You CAN set up a relationship with match fields that only matches to People Records with "Y" in the QuickTag field. You do not have to use a portal filter.