1 2 Previous Next 16 Replies Latest reply on May 3, 2017 12:40 PM by BruceRobertson

    using repetitions vs using lists

    JamesPeragine

      I'm doing a new build out of our CRM and there are many instances in which I have to make lists from the values in the portals on my layout.   So far I have been using a text field to create lists.   I've never fully delved into using Repetitions and Variable repetitions and I'm wondering if this is a more efficient method for what I need to accomplish.   Will this put more or less strain on the system

       

      One example of this is the following:

       

      I have a portal that pulls email addresses from a portal list for emailing. Here's the code that I have implemented.  This script is tied to a script trigger when a portal row is clicked.

       

      • Set Variable [ $count; Value:ValueCount ( List ( Deals_777::_rSubmissionList ) ) ]
      • Set Variable [ $funderEmails; Value:Funders_Deals77Submissions::SubmissionEmailAddress ]
      • If [ PatternCount (Deals_777::_rSubmissionList ; $funderEmails) = 1 ]
      • If [ GetValue ( List ( Deals_777::_rSubmissionList ) ; 1 ) = $funderEmails ]
      • If [ $count = 1 ]
      • Set Field [ Deals_777::_rSubmissionList; Substitute(Deals_777::_rSubmissionList;$funderEmails;"") ]
      • Else
      • Set Field [ Deals_777::_rSubmissionList; Substitute(Deals_777::_rSubmissionList;$funderEmails & ¶;"") ]
      • End If
      • Else
      • Set Field [ Deals_777::_rSubmissionList; Substitute(Deals_777::_rSubmissionList ;¶ & $funderEmails;"") ]
      • End If
      • Else
      • If [ $count = 0 ]
      • Set Field [ Deals_777::_rSubmissionList; $funderEmails ]
      • Else
      • Set Field [ Deals_777::_rSubmissionList; $funderEmails & ¶ & Deals_777::_rSubmissionList ]
      • End If
      • End If

       

       

      Am I better setting up a field or variable with 30-40 maximum field repetitions instead?

        • 1. Re: using repetitions vs using lists
          beverly

          Lists are Lists!

          Repeating (anythings) are NOT lists, but served that quasi-array role before we had list functions.

           

          I like Repeating fields (and repeating variables as temporary storage), but only for reporting (i.e. DISPLAY) of data otherwise stored normally (normalized). I use scripted Set Field to populate.

           

          you may be going down a road you will regret...

          but that's just my opinion.

          beverly

          1 of 1 people found this helpful
          • 2. Re: using repetitions vs using lists
            Jaymo

            Seems to me like the List function could possibly pull the email addresses from the portal's relationship into a return-separated list with a single Set Variable script step.

             

            Set Variable [$Emails; List(MYRELATIONSHIP::email_address)

            • 3. Re: using repetitions vs using lists
              JamesPeragine

              Thanks Beverly.   The lists are working great right now.  I just wanted to make sure that I was implementing a best practice technique by using them.  I've seen some people talk about using repetitions is these types of situations and wanted to get feedback on if/when to use them and I have not worked much with them thus far.

              • 4. Re: using repetitions vs using lists
                JamesPeragine

                Jaymo, I neglected to say that the user will be adding/subtracting the values to the list by clicking the portal rows (and triggering this script) otherwise that would be a much more efficient method

                • 5. Re: using repetitions vs using lists
                  philmodjunk

                  I really can't make much sense out of that script. Are you trying to set up a script that adds or removes an email from the list when the user clicks a portal row? (Click to add, click again to remove...)

                   

                  If so there are much simpler scripts for adding/removing values from lists.

                  • 6. Re: using repetitions vs using lists
                    JackRodges

                    Lists have a big pitfall inside a lot of great functionality.

                     

                    If an item in the List() is empty it is not used for display,etc. This can be useful or a problem, depending. Just keep it in mind.

                     

                    Repeating fields and variables maintain the empty value which may be needed.

                     

                    Think of it this way:

                    List shows the result that would result from a find that excludes empty fields.

                    Repeating is a show all.

                     

                    I am finding the use of a table to be more powerful than relying on a list, repeating field, etc. when transfering data into a tet field, etc. since the table can be searched, sorted or modified easily by anyone without the need of developer privileges or modifying scripts, etc.

                    • 7. Re: using repetitions vs using lists
                      JackRodges

                      Without knowing exactly what you will do with the list you might consider this.

                       

                      Button to go to related records showing only the visible items int he portal

                      Go to a table view showing perhaps just the email address.

                       

                      This eliminates all of the tedious stuff and provides a list of just the email address. Loop through the records to do whatever you want. You can send an email to everyone in the selection of record via a check box in the send mail function or loop through the records creating a text variable, etc.

                       

                      Or bypass the portal and go to the table with the addresses and do a search.

                      • 8. Re: using repetitions vs using lists
                        JamesPeragine

                        Phil Yes I am. If you have guidance on how I can make it more efficient I'm all ears.

                         

                        Here's what my current script is doing

                         

                        1) Set variable to the current Count of the total items already in my list

                        2) Set Variable to email address of the portal row/record that the user clicked

                        3) Looks to see if the email address is already in the list

                             a)  If it's in the list and it's the only value in the list then replace just the Value with ""

                             b) If there's more that one value that replace the value and the trailing Carriage return with ""

                        4) If the email address is not already in the list and there are no values in the list yet

                             a) add it as the new first value of the list without a trailing Carriage return.

                             b) If there are already values in the list then add the email address with a trailing Carriage return.

                        • 9. Re: using repetitions vs using lists
                          JackRodges

                          Also, from experience I have learned to use reports and calculated fields for ideas like this.

                           

                          For instance, creating a Category field for things like:

                          Sponsor

                          Donor

                          Lead

                          etc

                           

                          Lets the designer apply a value to each address and sort and find on that later. Multiple category fields can be added.

                           

                          Or, as I prefer, use a join table for Categories which makes for nicer reports and lets one account show up in many different categories rather than just one when the report is made from the category table rather than the account table.

                          • 10. Re: using repetitions vs using lists
                            BruceRobertson

                            I think you are over-complicating this.

                             

                            • Set Variable [ $thisEmail; Value:Funders_Deals77Submissions::SubmissionEmailAddress ]

                              • Set Variable [ $countInList ; PatternCount (Deals_777::_rSubmissionList ; $thisEmail )  ]

                              • If [ $countInList ]

                              • Set Field [ Deals_777::_rSubmissionList; Substitute(Deals_777::_rSubmissionList;$thisEmail;"") ]

                              • Else

                              • Set Field [ Deals_777::_rSubmissionList; List(Deals_777::_rSubmissionList;$thisEmail ) ]

                              • End If

                            1 of 1 people found this helpful
                            • 11. Re: using repetitions vs using lists
                              BruceRobertson
                              Am I better setting up a field or variable with 30-40 maximum field repetitions instead?

                              Where would the 30-40 figure come from? Couldn't it easily be 5; or 500?

                              So - no. Don't set up reps.

                              1 of 1 people found this helpful
                              • 12. Re: using repetitions vs using lists
                                philmodjunk

                                I'll include a download link to a teaching file that adds/removes items from a list. Look at the first "check boxes with scrollbars" example and look at the scripting used.

                                 

                                This script adds a value to the list if it is not in the list and removes it if it is:

                                 

                                If [ IsEmpty ( FilterValues ( Table::Value ; Table::List ) ) // Value is not in List ]

                                   Set Field [Table::List ; List ( Table::List ; Table::Value ) ]

                                Else

                                   #Value is already in list, remove it.
                                   Set Field [ Table::List ; See expression shown below and put it here ]
                                End If

                                 

                                Use this expression in the second set field step:

                                 

                                Let ( [ TheList = Table::List ;

                                           TheList = Substitute ( ¶ & TheList & ¶ ; Table::Value ; ¶ ) ] ;

                                           Middle ( TheList ; 2 ; Length ( TheList ) - 2 )

                                      )

                                 

                                Adventures in FileMaking #2--enhanced value selection

                                1 of 1 people found this helpful
                                • 13. Re: using repetitions vs using lists
                                  philmodjunk

                                  There was an omission in line 2 originally. I've now rectified that error.

                                  1 of 1 people found this helpful
                                  • 14. Re: using repetitions vs using lists
                                    JamesPeragine
                                    Set Field [ Deals_777::_rSubmissionList; List(Deals_777::_rSubmissionList;$thisEmail ) ]

                                    This is adds the value to the end of my list?   Nice!  Good to know

                                    1 2 Previous Next