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.

Featured Replies


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

$findreq1 =& $fm->newFindRequest('Accounts');

$findreq2 =& $fm->newFindRequest('Accounts');

$findreq1->addFindCriterion('acctype', 'User');

$findreq2->addFindCriterion('squestion', '1');

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

$compoundFind->add(2,$findreq2);

$result = $compoundFind->execute();

When i use the above compoundfind, I found all the records where the acctype=User also squestion=1

But i need the the records where acctype=User and squestion=1 (refer attached image: I need 2 records only which is marked in green color)

Please help me to alter the above find code to attain my solution

capture.png

Compound Find requests perform an or search (Criterion1 OR Criterion2). You only need the normal newFindCommand to perform an and search (Criterion1 AND Criterion2):


$findreq =& $fm->newFindCommand('Accounts');

$findreq->addFindCriterion('acctype', 'User');

$findreq->addFindCriterion('squestion', '1');

$result = $findreq->execute();

  • Author

Thank u doughemi,

With this same case how do i get the records where the acctype="User" and acctype="Family" ?

That means i have to filter more than one data from the single column.

Thanks your valuable reply and valuable time

In this case, you are looking to find records in which acctype="User" OR acctype ="Family". (it is impossible in this instance to have a record in which acctype contains both "User" AND "Family"). Thus, you would use the Compound Find structure:


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

$findreq1 =& $fm->newFindRequest('Accounts');

$findreq2 =& $fm->newFindRequest('Accounts');

$findreq1->addFindCriterion('acctype', 'User');

$findreq2->addFindCriterion('acctype', 'Family');

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

$compoundFind->add(2,$findreq2);

$result = $compoundFind->execute();




I would recommend that you research "Boolean AND and OR operators" to build your understanding of these important tools.  These operators have much more specific definitions than the common usage of the English words they are based on.



Now, if you were conducting a search for records which have either "User" or "Family" in the acctype field and at the same time have 1 in the squestion field, you would have to expand the Compound Find structure:



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

$findreq1 =& $fm->newFindRequest('Accounts');

$findreq2 =& $fm->newFindRequest('Accounts');

$findreq1->addFindCriterion('acctype', 'User');

$findreq1->addFindCriterion('squestion', '1');

$findreq2->addFindCriterion('acctype', 'Family');

$findreq2->addFindCriterion('squestion', '1');

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

$compoundFind->add(2,$findreq2);

$result = $compoundFind->execute();

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.