4 Replies Latest reply on Dec 1, 2011 1:05 PM by ccrumley

    FM php default find behaviour



      FM php default find behaviour

      Your post

      Can somebody tell me how a hange the default find behaviour when using php and FM server. If I create a find page using the wizard when a user clicks find without entering any find criteria onthe page Filemaker returns all the records in the database. What I want it to do is to fail to find anything. I'm guessing it can be changed in this part of the code but I don't know what to change t to.

       switch ($action) {
              case "find": {
              // clear the recid

              // create a find command
                 $findCommand = $fm->newFindCommand($layoutName);

              // get the posted record data from the findrecords page
                 $findrequestdata = $cgi->get('storedfindrequest');
                 if (isset($findrequestdata)) {
                     $findCom = prepareFindRequest($findrequestdata, $findCommand, $cgi);

                  // set the logical operator
                     $logicalOperator = $cgi->get('-lop');
                     if (isset($logicalOperator)) {
                 } else
                     $findCom = $fm->newFindAllCommand($layoutName);
              default: {
                 $findCom = & $fm->newFindAllCommand($layoutName);

      It looks like the default is a find all

      $findCom = $fm->newFindAllCommand($layoutName);

      is there a similar command to say find none ?

      regards paul.

        • 1. Re: FM php default find behaviour

          it seems that an empty find request is treated as "findall"

          try to change the

          if (isset($findrequestdata))


           if (TRUE)

          and see how filemaker treats the empty find request. If that doesn't work, the find request variable must be 'faked' by setting its value to something random where definitively no results are found. But try this one first.


          • 2. Re: FM php default find behaviour

            No sorry that has exactly the same effect.

            I have been trying to look 'inside' the find request to see if it is empty but I can't see how.

            I assumed there would be something in here

              $findrequestdata = $cgi->get('storedfindrequest');


             $findCom = prepareFindRequest($findrequestdata, $findCommand, $cgi);

            but if there is my php isn't good enough to find it.


            • 3. Re: FM php default find behaviour

              after the 

              $findrequestdata = $cgi->get('storedfindrequest');

              try inserting a

              if (!isset($findrequestdata)) $findrequestdata = "XXXX";

              • 4. Re: FM php default find behaviour

                have either of you found a fix for users not being able to return to the recordlist, and it 'remembering' what the user initially searched for?