Friday, December 21, 2018

Web Services > PHPToolkit > How to search with criteria specified for a checkbox boolean field

 The following code searches the file record type.  The criteria specified is the file folder, and if the Available without login field is checked.

 require_once '../PHPtoolkit.php';
 require_once 'login_info.php';
 global $myNSclient;
 $isOnline = true;
 $folderId = 2249;
 $FileSearch = new nsComplexObject("FileSearchBasic");
 $folderIdSearchField = new nsComplexObject("SearchMultiSelectField");
 $folderIdSearchField->setFields(array("operator"  => "anyOf",
           "searchValue" => array('internalId' => $folderId)));
 //Search Check Box boolean field
 $isOnlineSearchFieldBool = new nsComplexObject("SearchBooleanField");
 $isOnlineSearchFieldBool->setFields(array("searchValue" => $isOnline));
 $FileSearch->setFields(array("availableWithoutLogin" => $isOnlineSearchFieldBool, "folder" => $folderIdSearchField ));
 $searchResponseFileSearch = $myNSclient->search($FileSearch);

No comments:

Post a Comment