5 Replies Latest reply on Sep 29, 2013 12:00 PM by Stephen Huston

    I need to Cancel a Find from a script...

    artdoc

      I'm stymied by this. I have a love/hate thing with FMGo and the iPad's design making any pop-up list show up in a tiny new window. This is not acceptable for my file!

       

      I have created a very nice solution that works great (long story) but here comes my problem:

       

      I use a JobRecords file to create an estimate. That inclides a worksheet to list materials and build my job quote. When adding parts for a job, a button opens a second file called Products! There are some 2500+ parts listed, and it's tedious to scroll that long list, so I incorporated a Find command.

       

      I have my parts visible as a LIST view (fields only open to FIND, not browse), so finding a part works great, BUT...!

       

      If I scroll the entire list and find my item, each item has a button next to it that copies that item and then opens my Jobs file to allow pasting into a growing materials list. Then that Jobs layout has a button that returns to my Products file. So far so good.

       

      BUT when it is required to actually use a Find script, it starts out great: start entering the name of the thing I want and a list starts building as find results. Good to this point.

       

      When I see what I want in that result list, can I click the script button to copy that found item and go to Jobs? Nope! O course in the find results, the list is not showing the button!

       

      I always have to manually Cancel the Find! I have tried using Halt Script, Exit Script...No luck.

       

      The next trick is that having an Exit Script (with no way I see to ID what script I want to halt or exit!) is that my whole "copy go paste" script is stopped. And if I manually kill the find, my temporary found list disappears and I am back to looking at my list of 2500 parts!

       

      This is the ONE thing that is blocking my grand solution to get past the way the iPad treats finding and selecting.

       

      How can I script in a step to stop a script (Find) and then continue with the rest of a script? Maybe I need a specific script to Cancel" and then include that as a step in my copy/paste script?

       

      I hope this makes some sense.

       

      Steve

        • 1. Re: I need to Cancel a Find from a script...
          Stephen Huston

          You could insert scripts steps for optional actions depending on some state of the file or data, ie:

          • If (your test here, unclear to me what conditions you might want to use)
          • do whatever if those conditions are met, run a find or whatever.
          • End If

          and your script continues with or without having performed that action depending on your test results (calc).

           

          You can also aldd  "Else If" test to branch among  choices depending on which condition is first true.

           

          You might consider breaking some of the options into separate scripts and then call the desired action from a master script:

          • If (your condition)
          • Perform Script (your subscript A)
          • Else If (your next condition)
          • Perform Script (your subscript B)
          • Else If (your next condition) etc.
          • Perform Script (etc.)...
          • End If
          • and then anything else you want to always happen after the correct option ran, or even another series of tests.

          And you can capture $variables along the way in the first tests to determine what to do in the second part by testing the variable content.

          • 2. Re: I need to Cancel a Find from a script...
            erolst

            I've read this several times and I still don't understand what your problem is, or how your workflow is structured, for that matter.

            […] so I incorporated a Find command.

             

            I have my parts visible as a LIST view (fields only open to FIND, not browse), so finding a part works great, BUT...!

             

            If I scroll the entire list and find my item, each item has a button next to it that copies that item and then opens my Jobs file to allow pasting into a growing materials list. Then that Jobs layout has a button that returns to my Products file. So far so good.

             

            BUT when it is required to actually use a Find script, it starts out great: start entering the name of the thing I want and a list starts building as find results. Good to this point.

             

            When I see what I want in that result list, can I click the script button to copy that found item and go to Jobs? Nope! O course in the find results, the list is not showing the button!

             

            So what are the different scenarios in your workflow where “finding works great” and "when it is required to actually use a Find script"?

             

            And I don't understand the “of course” part? Even if you use different methods for performing a Find, why not use the same list – the one with the button?

             

            I guess I have to read it one more time, I might be just a hair's breadth away from understanding…

            • 3. Re: I need to Cancel a Find from a script...
              artdoc

              And I don't understand the “of course” part? Even if you use different methods for performing a Find, why not use the same list – the one with the button?

               

              Yes, it's hard to desribe each step. Maybe to clarify: my initial view of the productList is 2500 items, displayed in LIST format (each item has its own Form record, of course), and when that list shows, I can scroll down to locate a particular item. If I can find that, I click the name field and there is a button (for each item listed) that will copy that field and then return to the second file for Jobs. That file has a portal with places to list each part used on a job. There is a PASTE script that finds the first empty line and pastes in the item info copied from the Product file. Then another button takes me back to the Products for continued shopping.

               

              The PROBLEM: on an iPad the search results act too crazy for my taste. Windows increase in size when activated, searching opens a new tiny window to scroll through, it works but it's way goofy!

               

              My workaround involves a field called "lineInfo" that is only accessed in a Find script. Otherwise the content is visible of course, but not to be modified! I can visually search by scrolling (that was my Find method Part 1), however with so many names to scroll, I needed a Find script! That workes, but my results in a new list won't let me select an item and take it to the Job record.

               

              I have devised another workaround solution by scripting a change to Form view and just using a Command-F search. That brings up a list of potential items, and I can select ONE to display in Form view. Then the add to job button works.

               

              So in other words, I think I was pushed to think harder and find a way to deal with my search, and it seems to work.

               

              But I appreciate the time it took for both of you to suggest my path, and I will save the info for future work

               

              I just thought it interesting that there are script steps to initiate and work with starting a script, etc., but no simple way to kill a search. At least I still need to experiment more with Halt or Exit, etc. I'm learning.

              • 4. Re: I need to Cancel a Find from a script...
                erolst

                OK, good you got it working; sometimes it helps to just talk …

                artdoc wrote:

                I just thought it interesting that there are script steps to initiate and work with starting a script, etc., but no simple way to kill a search. At least I still need to experiment more with Halt or Exit, etc. I'm learning.

                 

                You can query fields, and you have a boatload of Status (Get) functions, all of which helps you to make the correct decisions in the course of a script.

                 

                Search field empty? Don't bother to start the script (and dim the button with CondForm…). Search term too short? Alert the user and Exit Script. No records found? Capture with Set Error Capture, then go back to your search field, or Show all Records, or show a dialog and decide on the fly what to do. One record found? Go to Form view. Multiple hits? Go to List view etc. See also Stephen's post above on that topic.

                 

                btw, while you're learning, I recommend getting familiar with using Set Variable and Set Field; this is a far more reliable technique than Copy & Paste (the fields involved don't need to be on the layout), it allows you to pre-process your data before using it in another place (there's no Get ( Clipboard ) command), and it doesn't overwrite the Clipboard contents.

                • 5. Re: I need to Cancel a Find from a script...
                  Stephen Huston

                  artdoc wrote, in part:

                   

                  I just thought it interesting that there are script steps to initiate and work with starting a script, etc., but no simple way to kill a search. At least I still need to experiment more with Halt or Exit, etc. I'm learning.

                  These 2 script steps together will drop you back into Browse mode and kill a Find, assuming you have used error trapping so that you are not facing Find-result error dialogs, but the records you will land on (if any as opposed to a null set) will depend, to a large extent, on what steps you processed ahead of them in your script:

                  • Enter Browse Mode
                  • Exit Script (or Halt Script, if you are sure you want to kill any script que completely)

                  Again, these probably need to be controlled by some If/If Else tests to see if they should be invoked based on the script's current conditions....