Skip 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.

multiple search on single field

Featured Replies

OK, I know I saw something posted on this before but cannot find it...

I am trying to get a found set that includes 3 specific publications using CatalogNumber as the search field.

My code:

$hotsearch=new FX($serverIP,$webCompanionPort);

$hotsearch->SetDBData('Pub_Publication_.fp5','ForPHP');

$hotsearch->AddDBParam('CatalogNumber', $hotpub1);

$hotsearch->AddDBParam('CatalogNumber', $hotpub2);

$hotsearch->AddDBParam('CatalogNumber', $hotpub3);

$hotsearch->AddDBParam('-lop', 'or');

$hotsearchResult=$hotsearch->FMFind();

foreach($hotsearchResult['data'] as $hot2=>$hotdata2);

This will only find one record (the last one).

In filemaker I can use the "addition request" to add more parameters to the find using the same field.

Any help is always appreciated.

I've worked with someone recently who has a similar problem. However, I was able to get it to work on my combination of software.

I am using FM6 with FX 4.

Here is a way of testing:

$findrecord->AddDBParam("Info_ID","102 104 105");

findrecord->AddDBParam("-lop","or");

$findrecordResult=$findrecord->FMFind();

This just has a list of search criteria as a space-delimited string. However, multiple AddDBParam should also work.

Good Luck.

Garry

  • Author

I'll give it a try,

I wonder if there is a difference between ' and " in the code.

I noticed for '-script' that when I used ("-script", "placeorder") it magically worked, while the single quote gave problems.

I'll let you know how it goes - because logically, my code should be clean.

FM 6 and FX 4.02 on Windows 2000 apache 2, php 4.5

  • Author

Gary,

I played around with a few combinations and watch what happend in the FM database. It appears that all three records were appearing and that the key was where I was placing my 'foreach' statement.

I also made sure that I used doublequotes ( " ) instead of single quotes.

Here is the final working code for reference:


$hotsearch=new FX($serverIP,$webCompanionPort);

$hotsearch->SetDBData('Pub_Publication_.fp5','ForPHP');

$hotsearch->AddDBParam("CatalogNumber", "25570");

$hotsearch->AddDBParam("CatalogNumber", "4633");

$hotsearch->AddDBParam("CatalogNumber", "25648");

$hotsearch->AddDBParam("-lop", "or");

$hotsearchResult=$hotsearch->FMFind();




The in the html I added this code:





Popular Picks

<? foreach($hotsearchResult['data'] as $hot2=>$hotdata2) {?> [*]<? echo $hotdata2['Title'][0];?> <? }?> [/list]




And finally a very useful bit of code for checking where the data was ending up was:




 print "
-";
print_r($hotsearchResult); print "-";

This helped located the missing recorded and proved that in fact they might have been there all along, but the foreach statement needed to be correctly used.

Ah, the old "foreach"!

Garry

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.