7 Replies Latest reply on Feb 6, 2017 7:26 AM by thehalpeen

    Multi-find/search to extend found set

    thehalpeen

      I’m not sure how to set this up in a script or what technique to use.

       

      I’d like to search for a customer and then say via a ‘button’ add to the search request. I’m not talking about your normal way – enter Find Mode – then type search criteria – then add New ( to add another search request).

       

      My requirement/wish is to type into a search box – then find those records, then add to the search by clicking ‘Add’ button – type in another criteria and this would add to my found set – is this possible?

       

      I have inserted screenshots two layouts – one is a portal layout and the other is the actual layout based on the contacts table. The reason – again, I’m not sure which layout to use to do this.

       

      I’ve also attached the file.

      Portal multi search.PNG

      contact Table multi search.PNG

        • 1. Re: Multi-find/search to extend found set
          mikebeargie

          assuming your search field is global, then your add button script would look like:

          Set Variable [ $search ; table::searchfield ]

          Modify Last Find

          New Record/Request/Page
          Set Field [ table::companyName ; $search ]

          Perform Find

          Set Field [ table::searchfield ; "" ]

           

          or this:

          Set Variable [ $search ; table::searchfield ]

          Enter Find Mode

          Set Field [ table::companyName ; $search ]

          Extend Found Set

          Set Field [ table::searchfield ; "" ]

           

          If you want, you could also keep a virtual list of search parameters as you add them, allowing you to show users what search terms they have added.

          Set Variable [ $$searchlist ; List ( $$searchlist ; $search ) ]

           

          And stick the merge text on your layout somewhere:

          <<$$searchlist>>

          • 2. Re: Multi-find/search to extend found set
            SteveMartino

            What I did is have a list layout like your second screenshot.  The search box has type ahead (global) that searches for the record, marks the checkbox.  By keeping records sorted it moves it to the top of the list, clears search box and returns cursor to search box to type the next one.

            When I click the add button, the script will find the checked records, close this window (returning to layout with the previous found set) and extend that found set (and clear the check boxes).

            • 3. Re: Multi-find/search to extend found set
              thehalpeen

              Mike,

              I've almost got this working. I like the idea of the search parameter list.

               

              I am doing all my searches in the context of the parent table - contacts - is that correct?.

               

              So for the first script (see below) - do I start with a general 'find' and then use this script - attached to a button - to modify the find. In other words, I do my first search in the 'Company' field and then do the 'modified' search using the global field call 'gSearch'  - is that correct? This appraoch seems to work for me. How do I clear the Search parameter list?

              Set Variable [ $search ; table::searchfield ]

              Modify Last Find

              New Record/Request/Page
              Set Field [ table::companyName ; $search ]

              Perform Find

              Set Field [ table::searchfield ; "" ]

               

              In relation to the second script - forgive me, but I can't get this to work - it's attached to the 2nd button

               

              Set Variable [ $search ; table::searchfield ]

              Enter Find Mode

              Set Field [ table::companyName ; $search ]

              Extend Found Set

              Set Field [ table::searchfield ; "" ]

               

              I have attached the file with the scripts attached to the buttons

              multi find screen 2.PNG

              • 4. Re: Multi-find/search to extend found set
                thehalpeen

                Steve,

                I'm struggling to understand your technique.

                 

                The search box has type ahead (global) that searches for the record, marks the checkbox.

                 

                When you say 'Type-ahead'  see above quote - are you talking about auto-complete. As far as I know this does not work on global fields.

                 

                When I click the add button, the script will find the checked records, close this window (returning to layout with the previous found set) and extend that found set (and clear the check boxes).

                So you open up another window to do the expanded search?. Do you have a button on the first layout  - maybe called 'Expand Search'.

                 

                I'm a bit lost!

                • 5. Re: Multi-find/search to extend found set
                  SteveMartino

                  Button on first layout is 'Add Customer', which opens a picker window (list view).  The 'Type Ahead' is a keystroke script trigger on the global field.  The global field is just a text field.

                  Here's a sample, just follow the red prompts.

                  Look on the script debugger to see which scripts are called and what they do

                  u/n admin

                  p/w 1234

                  Edit:  Had to remove file.  After I delete some customer info, I'll repost.

                  • 6. Re: Multi-find/search to extend found set
                    thehalpeen

                    Steve,

                     

                    A very impressive piece of work. Very helpful - thanks for going to so muxh trouble. Just have to try and build in into my solution

                    • 7. Re: Multi-find/search to extend found set
                      thehalpeen

                      Mike,

                       

                      I got your scripts working over the weekend - it was all about understanding how 'modify find' works in a script - thanks again.