8 Replies Latest reply on Dec 20, 2012 2:38 PM by philmodjunk

    two search criteria for one field in single Find

    henryhu91

      Title

      two search criteria for one field in single Find

      Post

           Hello FM users, 

           is there a way you can perform Find on one field with mutilple criteria?

           for example, I have a field called Ship Status and there're criteria like Ready to Ship, Cancel, Delay?

           how can I perform Find if I only wanna see cancel and Delay?

        • 1. Re: two search criteria for one field in single Find
          philmodjunk

               how can I perform Find if I only wanna see cancel and Delay?

               General outline:

               Enter find mode
               Put "cancel" in the status field
               Create a new request (see option in Requests menu)
               put "Delay" in the status field
               Perform the find

               This finds all recors with ship status of either "Delay" or "Cancel".

               A find script can be built on the same pattern, using New Record/Request to create the second request. And Set Field may be used to put criteria in the ship status field.

          • 2. Re: two search criteria for one field in single Find
            henryhu91

                 thanks how about global field?

                 if I use check box set, would users gonna be able to select mutiple value and search will work?

            • 3. Re: two search criteria for one field in single Find
              philmodjunk

                   Yes, if you write a script that loops through the list of values produced by the global check box field putting one such value in each request created by the script.

                   Say your globlal field is named Globals::gShippingStatus

                   Go To Layout [layout based on table with ShipStatus field that you use for displaying search results]
                   Enter FInd Mode []
                   Loop
                       Set Variable [$K ; value: $K + 1]
                       Set Field [ YourTable::ShipStatus ; GetValue ( Globals::gShippingStatus ; $K ) ]
                       Exit Loop If [ $K > Valuecount ( Globals::gShippingStatus) ]
                       New Record/Request
                   End Loop
                   Set Error Capture [on]
                   Perform Find []
                    

              • 4. Re: two search criteria for one field in single Find
                henryhu91

                     Thanks Phil. it's working. 

                     I've one more question. 

                     this is the customized list that I've in my database. 

                      

                     On Order
                     Ready to Ship
                     Shipped
                     Cancelled
                     On Hold
                     Need Attention
                     Completed
                      
                     As you see, I have blank to search all the empty value in the field. however it's not searching at all. 
                     and in checkbox set i can't select option for blank to search empty value as well.
                     how can I fix that problem?
                      
                • 5. Re: two search criteria for one field in single Find
                  philmodjunk

                       You could add a value such "Is Empty" or "Is Blank"....

                       The script could check for that value, and if selected, put a lone "=" in the field.

                       Go To Layout [layout based on table with ShipStatus field that you use for displaying search results]
                       Enter FInd Mode []
                       Loop
                           Set Variable [$K ; value: $K + 1]
                           Set Field [ YourTable::ShipStatus ; Let ( v = GetValue ( Globals::gShippingStatus ; $K ) ; If ( v = "Is Empty" ; "=" ; v ) ) ]
                           Exit Loop If [ $K > Valuecount ( Globals::gShippingStatus) ]
                           New Record/Request
                       End Loop
                       Set Error Capture [on]
                       Perform Find []

                  • 6. Re: two search criteria for one field in single Find
                    henryhu91

                         Thank Phil. 

                         Do you know how to create drop down menu with checkboxes in filemaker for global field?

                         If I have like 20 value options for shipping status, It will be huge checkbox field for global field.

                         something like this?

                    • 7. Re: two search criteria for one field in single Find
                      henryhu91

                           and how about "Show all Records" 

                           Let (v=GetValue ( SU_Send to US::g_Item Status; $K ) ; If (v="Is Empty" ; "=" ; v)  what else should I modify in order to show all records with sorting?

                      • 8. Re: two search criteria for one field in single Find
                        philmodjunk

                             If show all records is selected, just do a Show All Records in your script instead of this loop as now the other criteria that may or may not have been selected no longer affect the results. I'd just add a show all button set to run a script with Show All Records to keep things simple.

                             It is not possible with built in FileMaker tools to create a drop down list with checkboxes.

                             You can, however, make multiple selections in the drop down by Ctrl-clicking values. (I really wish that we had the option to prevent this as it is often an undesirable way to select values from a value list.)

                             You can use a portal with a scroll bar that looks and functions as though it is a checkbox set.