Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Featured Replies

Here is my code:


$compoundFind =& $fm->newCompoundFindCommand('MyJobs');

$findreq =& $fm->newFindRequest('MyJobs');

$findreq->addFindCriterion('JobStatus', 'Complete');

$findreq->setOmit(true);

$compoundFind->add(1,$findreq);

$compoundFind->addSortRule('CustomerNumber', 1, FILEMAKER_SORT_DESCEND);

$result = $compoundFind->execute();

I expect this to return all of MyJobs that are NOT marked as complete from MyJobs layout.

Instead I get ONLY the jobs that ARE marked as Complete.

It seems so simple, yet I am so confused.

  • 1 year later...
  • Newbies

I'm having the exact same problem! Is this a bug in the API?

  • Newbies

Oh wow! So I figured out a trick... In your example RCooke71, it would look something like that:

$compoundFind =& $fm->newCompoundFindCommand('MyJobs');
$findreq1 =& $fm->newFindRequest('MyJobs'); // Get all
$findreq2 =& $fm->newFindRequest('MyJobs');
$findreq2->addFindCriterion('JobStatus', 'Complete');
$findreq2->setOmit(true); // Omit what you want
$compoundFind->add(1,$findreq1); // First add the "get all"
$compoundFind->add(2,$findreq2); // Put the omit at the very end
$compoundFind->addSortRule('CustomerNumber', 1, FILEMAKER_SORT_DESCEND);
$result = $compoundFind->execute();

In my tests, the order you add your findRequests to the compoundFind mattered...

If you add the omits first it returns the same wrong result!

 

Hope it helped!

  • 5 months later...
  • Newbies

The above does not work for me unless I add a constraint to findreq1. I get "Unknown error". If I add a constraint that will fetch all records (e.g. "*" in a mandatory field) then it works in any order. I think this means that although in the FM interface you can do a query with just a single omit constraint, you can't do this via PHP. You have to have a constraint that essentially fetches all records, and then add omit constraints to subtract from that. It's a royal pain for me because I don't know which fields are like this and there's not actually a guarantee that there always will be a mandatory field...


This also means that I have a bug in another web application. If someone enters an instruction to search for a field that does not contain a certain value ... this works ... unless it is the only constraint, in which case it retrieves every record that matches. I think FM PHP ignores "omit" on the first addFindCriterion.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.