1 2 3 Previous Next 40 Replies Latest reply on Apr 20, 2017 2:06 PM by tleitzke

    Better Find


      I am trying to make a list be filtered by several fields (by value list), and I want to be able to have some fields just be empty- but still Perform Find and find everything. I tried using an if statement to check if the specific fields are ' "" ' (Which I think is the same as being empty), but, it did not work as I thought it would. Pretty much brings up nothing on any search (even when I put the 3 selector to a known working record).


      -I want to be able to have empty fields not obstruct finds

      -I don't want to have a long script doing every 'empty' scenario with the 3 fields (which is only 9, but that is excessive)


      I couldn't really find anything for having empty criteria be ignored.

        • 1. Re: Better Find

          If you are specifying find criteria in global fields and then using a script to set up find requests, you shouldn't have to do any checking for empty fields.


          Say that you have two global fields. Your script might look like this:


          Enter FInd Mode [pause: off ]
          Set Field [Table::Field1 ; Table::globalField1 ]

          Set Field [Table::Field2 ; Table::globalField2 ]
          Set Error Capture [on]

          Perform Find [  ]

          If [ Get ( FoundCount ) = 0 ]

            Show custom dialog ["no records found"]


          If you leave globalField1 empty, it's as though the first set field does not exist as it sets an empty field to an empty value.


          And your scripted find should still work.

          • 2. Re: Better Find

            I am using global fields for the search. But when I directly use them without sending them to variables (like I am guessing that script it doing), it always finds nothing. (If they are all empty- using the 'Clear' command, nothing is found still). I have to use a variable in between for anything to be properly found.

            • 3. Re: Better Find

              You should be able to pattern your script after the example That I have posted.


              Sounds like there are other issues keeping your script from working or you don't have fields with global storage specified like you think you do. You might post your script here for others to look at.


              Here is a link to other scripted find examples:


              Scripted Find Examples

              • 4. Re: Better Find

                the script is simply:


                Set Error Capture [On]

                Show All Record {Note: to make sure new find isn't obstructed by previous}

                Perform Find [Restore] {Note: it places the 'Restore' there. Not sure the meaning}

                if [Get (FoundCount) = 0]

                       Show Custom Dialog ["Equipment Error: 404"; "No Equipment Found"]

                End If



                With the search criteria being:


                Those 3 Home:: fields are set in storage->global


                (I know Base Description and Type are named differently. It was a late change from 'base description' to 'type', and have not taken the time to change it)

                • 5. Re: Better Find

                  You cannot refer to the contents of global fields inside stored find criteria. Please note how this is different from the examples that I have provided and for that very reason. (Stored criteria can't evaluate a calculation and that's what you get when you refer to global fields inside the stored criteria.)

                  • 6. Re: Better Find

                    And you don't need show all records. This step has no effect on the results of a find performed afterwards.

                    • 7. Re: Better Find

                      So I made 3 (Non-global) fields in the current layout's table and changed the find criteria to those 3 new fields properly, and matched to your script. It still just comes out blank every time, even with know records that should show up.


                      (And I deleted that 'Show All')

                      • 8. Re: Better Find

                        Why nonglobal fields?


                        You need global fields and you need to write the script following the pattern I have suggested.

                        • 9. Re: Better Find

                          the fields for find criteria (that get set to, from the global ones) are set to non-global because you said

                          philmodjunk wrote:


                          You cannot refer to the contents of global fields inside stored find criteria


                          • 10. Re: Better Find

                            And I also said to write the script using the pattern provided.


                            non global fields are blank in find mode so they cannot be used in stored search criteria either.

                            • 11. Re: Better Find

                              I have an almost exact replica of your script, as seen in this image (Excluding the 'Find Mode', as I do not want the user to EVER enter find mode, but stay in browser mode.)



                              • 12. Re: Better Find

                                It's not the same.


                                You don't have:

                                Enter find mode [pause:off]


                                and you have:

                                Perform find [restore]


                                instead of:


                                Perform Find [ ]

                                • 13. Re: Better Find

                                  Filemaker automattically adds "Restore" into "Perform Find[]". I have no control over that at all.


                                  I tried adding "Enter Find Mode [Pause:Off], but it comes up with the same empty results (As long as any field is empty, results are empty).




                                  • 14. Re: Better Find

                                    You can clear the stored criteria from the Perform Find set. You just need to clear the "specify find requests" check box.

                                    1 2 3 Previous Next