AnsweredAssumed Answered

FileMaker PHP API - setResultLayout with Find Command

Question asked by fmdataweb on Jan 10, 2016
Latest reply on Feb 10, 2016 by TSGal

I'm using setResultLayout for the first time so I can search on one layout with all the find fields on them but then switch to a much simpler layout with just the fields required for the search results. My search looks like this:

 

$request = $fm->newFindCommand('WebSearch');
$request->addFindCriterion('customerName', $_GET['contactName']);

$request->setRange($skip, $max);

// Set the layout to use for the Search Results
$request->setResultLayout( 'WebSummaryList' );
   
// Perform the Find
$result = $request->execute();
   
if (FileMaker::isError($result)) {
    if ($result->code = 401) {
    $findError = 'There are no Records that match that request: '. ' (' . $result->code . ')';
    } else {
    $findError = 'Find Error: '. $result->getMessage(). ' (' . $result->code . ')';
    }   

} else {
$records = $result->getRecords();
}

--

I'm finding that when I include the line $request->setResultLayout( 'WebSummaryList' ) that my test for an error fails - if (FileMaker::isError($result)). I'm performing some finds with criteria that I know does not exist but the $findError variable is not getting populated (it returns 0 records). If I remove the line $request->setResultLayout( 'WebSummaryList' ) then the $findError variable is getting populated correctly.

 

Can anyone see what I might be doing wrong or is this expected behaviour etc?

thanks,

Steve

Outcomes