8 Replies Latest reply on Jan 17, 2012 5:44 PM by Polarpro

    Adding records to a saved found set

    Polarpro

      Hey there,

       

      When one of my users executes a find he has the option to save the found set, in order to export these records later. To save the found set I use a technique that uses a variable: A script loops through all the records, puts the id of each record into a variable, and after the looping is done all the record ids are being put into a global field. The ids are separated by a ¶.

       

      My aim is to make it possible that a user can perform multiple finds, select the desired records and add these records to a saved set of records. So, this is not about extending a "normal" found set, this is about extending a saved set of records.

       

      Adding multiple found sets to the found set is actually not a problem and quite fast; however, if I simply add another found set to a saved set of records it easily happens that I have duplicate record ids in my global field. For example, saving first a set that consists of "¶15¶3¶1¶11¶" and then adding "¶3¶1¶28¶" results in "¶15¶3¶1¶11¶¶3¶1¶28¶". I've written a script that eliminates these duplicate record ids and the double returns, and it works fine on smaller sets, but as soon as I add 2000 to a set of 4000 record ids the script is getting way too slow.

       

      So, one question is: Is there a simpler way to add record ids to a list of record ids than the one I use?

       

      (If no, I guess I have to try to make the way I add a set to another one quicker. The script step I use contains

      "¶" & Substitute ( UniqueValues ( adresses::gXId & $Ids ) ; "¶¶" ; "¶" ) & "¶"

      to remove all the duplicate ids and double returns. UniqueValues is a custom function that might slow down the process, too.)

       

      Many Thanks for your suggestions,

      Michael

       

      __________________________________

      Michael Jupe

      Dipl.-Bibliothekar

      Redakteur Ressort Dokumentation

       

      FOCUS Magazin Verlag GmbH

      Arabellastraße 23

      81925 München

       

      Tel.: 089 / 9250 2605

      Fax: 089 / 9250 2832

        • 1. Re: Adding records to a saved found set
          RayCologon

          Hi Michael,

           

          From your description, at present you are looping to gather all the IDs, then performing a second process to eliminate the duplicates.

           

          Have you considered adding a test within the loop to only add IDs if they aren't already there. Collapsing the processes into one in this way may save you some time.

           

          Regards,

          Ray

          ------------------------------------------------

          R J Cologon, Ph.D.

          FileMaker Certified Developer

          Author, FileMaker Pro 10 Bible

          NightWing Enterprises, Melbourne, Australia

          http://www.nightwingenterprises.com

          ------------------------------------------------

          1 of 1 people found this helpful
          • 2. Re: Adding records to a saved found set
            AlanStirling

            Hi Michael

             

            Why are you worried about the duplicate IDs?

             

            They won't affect your find (except it might be a bit slower ...).

             

            But how much time does it take for you to try and remove these duplicates?

             

            If it were me, I would just ignore them, unless they do cause your system to misbehave.

             

            Best wishes - Alan Stirling, London UK

             

            Alan Stirling Technology Ltd, 135 Lisson Grove, London NW1 6UP

            +44 (0) 20 7724 2456 - alan@ast.fm - www.ast.fm

            FileMaker Pro Developer - Certified for FM versions: 7 to 11.

            1 of 1 people found this helpful
            • 3. Re: Adding records to a saved found set
              Polarpro

              Hey Ray,

               

              Thanks a lot for this suggestion. I changed it an measured it, and when adding about 4000 to 5000 saved messages it is now 4 times faster and needs only 20 seconds.

               

              Regards,

              Mike

              • 4. Re: Adding records to a saved found set
                Polarpro

                Hey Alan,

                 

                That's a good point...  The reason why I worried a little is that I like to get rid off "useless" data (or carriage returns) right away, so that they don't interfere with other (future) operations in what way ever.

                 

                As for the actual export things seem to work fine even if I have multiple entries in my list of record ids. For retrieving all the saved ids I use a self relationship, and through this relationship I can retrieve a list of uniqie ids, so no record will be exported more than once.

                 

                Regards,

                Mike

                • 5. Re: Adding records to a saved found set
                  RayCologon

                  Polarpro wrote:

                   

                  Hey Ray,

                   

                  Thanks a lot for this suggestion. I changed it an measured it, and when adding about 4000 to 5000 saved messages it is now 4 times faster and needs only 20 seconds.

                   

                  Regards,

                  Mike

                   

                  Hi Mike,

                   

                  Glad that helped some.

                   

                  I guess the question now is whether a 4x improvement is sufficient and/or acceptable to your users?

                   

                  Regards,

                  Ray

                  ------------------------------------------------

                  R J Cologon, Ph.D.

                  FileMaker Certified Developer

                  Author, FileMaker Pro 10 Bible

                  NightWing Enterprises, Melbourne, Australia

                  http://www.nightwingenterprises.com

                  ------------------------------------------------

                  • 6. Re: Adding records to a saved found set
                    Polarpro

                    Well, 20 seconds in this very special case is o.k., but I'll try to find some more ways to make this script go faster. And I will think about Alan Stirling's idea. Thanks again.

                     

                    Regards,

                    Mike

                    • 7. Re: Adding records to a saved found set
                      Oliver_Reid

                      There is " UNIQUE" custom function on briandunning.com that is much faster than script and will reurn unique values form a list.

                      • 8. Re: Adding records to a saved found set
                        Polarpro

                        Thanks for mentioning UniqueValues. I already had tried it; however, as for avoiding double values, faster than this function is adding a test within the loop to only add IDs if they aren't already there, as Ray suggested.