12 Replies Latest reply on Mar 5, 2014 2:26 PM by CarrieB.

    Quick Find doesn't recognize Get(Found Count)=0?

    CarrieB.

      Title

      Quick Find doesn't recognize Get(Found Count)=0?

      Post

           I have a script that runs a Quick Find and then performs different actions based on the found results. I'm using "If [Get(Found Count)=0]" and "If [Get(Found Count)=1]". If the result is 1, then the script runs properly, but if the result is 0, it does not. Any idea why? Is there another way to script this request?

           Thanks!

        • 1. Re: Quick Find doesn't recognize Get(Found Count)=0?
          philmodjunk

               Something else must be wrong with your script.

               I tried the following test:

               Perform Quick Find [Globals::GlobalField]
               If [ Get ( FoundCount ) = 0 ]
                  Show Custom Dialog ["no records found"]
               End If

               and when I put text into the global field that did not match to any field/record in my database, I got zero records in my found set and the custom dialog appeared.

               Perhaps some other aspect of your script is keeping the If block from ever being executed.

          • 2. Re: Quick Find doesn't recognize Get(Found Count)=0?
            CarrieB.

                 Hmm ... I wonder what it could be. I use the same script when I run a regular find and it works. But, it doesn't work with the Quick Find. I will try rewriting the script and see what happens.

                 Thanks!

            • 3. Re: Quick Find doesn't recognize Get(Found Count)=0?
              philmodjunk

                   You can also post the script here for others to examine.

                   To post a script to the forum:

                     
              1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
              2.      
              3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
              4.      
              5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
              6.      
              7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
              • 4. Re: Quick Find doesn't recognize Get(Found Count)=0?
                CarrieB.

                     I tried writing the script from scratch, but still come across an issue with the zero result. I was able to change the result by removing some items, but it's still not working. Instead of showing the custom dialog, a FileMaker pop-up shows up and then ignores the rest of the command. (If Error Capture is not on). The result of 1 and greater than 1 do work. Just not the 0. See below for my script.

                     Thanks!

                • 5. Re: Quick Find doesn't recognize Get(Found Count)=0?
                  CarrieB.

                       Sorry ... I uploaded the wrong file. Here is the script. :)

                  • 6. Re: Quick Find doesn't recognize Get(Found Count)=0?
                    philmodjunk

                         I see no errors in your script, but are you sure that this is the script that you are performing? The error message that you posted does not appear when Perform Quick Find fails to find any records. That error message pops up if Perform Find[] is executed and no records are found.

                         On a technical note, whether you use perform find or perform quick find, once that step has executed your FileMaker window will be in Browse mode in either case. Get ( FoundCount ) and any other function or calculation in your script steps should then evaluate in exactly the same way.

                    • 7. Re: Quick Find doesn't recognize Get(Found Count)=0?
                      CarrieB.

                           Yes, that is the script I'm running. I even stripped it down to the attached and still get the FileMaker error about no records matching the find request. Must be a bug?

                      • 8. Re: Quick Find doesn't recognize Get(Found Count)=0?
                        CarrieB.

                             It's my first Show Custom Dialog command that is messing it up. If I remove that, it works. I tried renaming the dialog box and that didn't make a difference. Strange...

                        • 9. Re: Quick Find doesn't recognize Get(Found Count)=0?
                          philmodjunk

                               What mode are you in when this script runs?

                               Is g_QuickFind a field with global storage?

                               Here's my script and the dialog box produced. I'm using FileMaker 13 on Windows 7.

                          • 10. Re: Quick Find doesn't recognize Get(Found Count)=0?
                            philmodjunk

                                 Aha!

                                 I took a closer look at things and this is the system error message not the custom dialog that I am looking at.

                                 When I examine my layout after running the script, I see that I do not have an empty found set. Unlike Perform Find--which I almost always prefer over Quick Find, a failed quick find does not produce an empty found set and thus the script is working correctly, it's just not producing the results that you expected.

                                 Try this Script:

                            • 11. Re: Quick Find doesn't recognize Get(Found Count)=0?
                              CarrieB.

                                   For this testing, I am in Browse mode. Though I run it in Find mode as well. Yes, g_QuickFind is a field with global storage. I'm using FileMaker 13 on Mac.

                                   Maybe I'm looking at your images wrong, but it looks like you get a FileMaker error instead of your Custom Dialog. Is that right? In which case, we would have the same problem.

                                   If I remove the Custom Dialog box where I input the criteria into the global field, it works fine.

                              • 12. Re: Quick Find doesn't recognize Get(Found Count)=0?
                                CarrieB.

                                     Thank you! That did the trick!