Here are several search strategies you might need. For the following examples, the basic search is:
$nameFind =& $fm->newFindCommand('web_NameSearch');
--one of the chunks of code below--
$nameFindresult = $nameFind->execute();
All names in table.
| Jack | Robb | 36 |
| Jacob | Schmidt | 44 |
| James | Lee | 37 |
| Jim | Nelson | 36 |
| Rob | Sanchez | 44 |
| Robert | James | 50 |
| Robbin | Williams | 49 |
Simple search
$nameFind->addFindCriterion('First', 'rob');
| Rob | Sanchez |
| Robert | James |
| Robbin | Williams |
Exact matching
$nameFind->addFindCriterion('First', '=rob');
| Rob | Sanchez |
Change the context to OR
$nameFind->addFindCriterion('First', 'james');
$nameFind->addFindCriterion('Last', 'james');
$nameFind->setLogicalOperator(FILEMAKER_FIND_OR);
| James | Lee |
| Robert | James |
Use an operator
$nameFind->addFindCriterion('Age', '>=44');
| Jacob | Schmidt | 44 |
| Rob | Sanchez | 44 |
| Robert | James | 50 |
| Robbin | Williams | 49 |
Leave a comment