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.

combining the and and or operator in a request?

Featured Replies

  • Newbies

I 'd like to set up a search query requiring certain values to be true,

and for one field the value should be one of 3 values.

Thus, search for records matching:

field A value = xxx AND

field B value= xxx AND

field C value= xxx AND

(fieldZ = aaa or fieldZ = bbb or fieldZ = ccc)

How is this done in CDML?

look in the sample files forum

Hi, amk! I'm not sure but I think I can interpret your question in a couple different ways, but here is a clipping of the CDML reference database that may help... --ST

-----

-lop

What it does

Combines the find criteria as an AND or OR find request.

Value is

Either AND or OR. If the -LOP variable tag is not used, then the find request is assumed to be an AND request.

Syntax example(s)

Find a record using a link

<a href="FMPro?-DB=db.fp5&-Format=rslt.htm&Country=USA+UK&-LOP=or&-Find">Find United states of America or United Kingdom records</a>

Find some records using a form action

<form action="FMPro" method="post">

<input type="hidden" name="-DB" value="names.fp5">

<input type="hidden" name="-Format" value="results.htm">

<input type="hidden" name="-LOP" value="OR">

Enter a country and click Find to see the results.<br>

<input type="text" size=12 name="Country" value="USA UK">

<input type="submit" name="-Find" value="Find">

</form>

Other tags that are required

-DB, -Find, -Format, field name

See also

-Op

-----

How do you perform complex finds from the web? I'm really stumped. Can somebody help out?

Example:

Find all players on a team whose (position is QB -or- CB) AND whose (weight > 190)

How could this be phrased into a FileMaker URL? It uses both AND and OR -- how does the -lop tag work when you need to use it more than once? Help, please?

Webcompanion can not perform search with mixed Logical operator.

It's because this sort of search requiere at least 2 request in Filemaker

There are no real solution

You can perform a script but it's not a real solution for web solution

You can also try to use a calculted field

An other solution is to use a AE cgi on mac

One way I've been able to get around this is by using Javascript. The concept is to load the results of one search into an array then process the array.

The limitation is size of inital result and speed.

Good Luck.

Garry

  • Author
  • Newbies

Thanks everybody!

So w.c. does what the manual says then, combines all find criteria, i.e. evaluates them all "in a lump".

Ok, I get it. And a search with a mixed logical op isn't an available, thanks, for pointing that out omiossec.

A script then. See what you mean Gary Claridge. I think, for this issue (and hoping not to find anymore, after all it was Friday 13th), I'll flip the last condition around so it works with the default and, specifying the values that the last field must NOT have.

(Of course, not a solution in case we're dealing with a large set, but mine isn't. )

Yet another way would be perhaps to add some "identifier" to the field name values I need to look for and say search ...where begins with, ends with..)

We'll see.

Thanks again all for your quick and accurate answers!

amk

Whoops, I did forget to mention that you can use the [FMP-If] tags to confine the found set. This is instead of using Javascript.

All the best.

Garry

Thanks Olivier and Garry. Your responses helped me understand this much better. I'm going to use your idea Garry to make multiple calls to the database and combine the resulting arrays. Thanks again!

Howdy, howdy! Just to elaborate on Garry's non-JavaScript [FMP-if] answer, you can perform a regular search using the basic criteria ABC and then use IF statements to only show information for those records satisfying your desired OR parameters...

[FMP-record]

[FMP-if: field:color .eq. blue]

[FMP-field:item] [FMP-field:price] [FMP-field:color] (blue or red only)

/FMP-if]

[FMP-if: field:color .eq. red]

[FMP-field:item] [FMP-field:price] [FMP-field:color] (blue or red only)

[/FMP-if]

[/FMP-record]

However, this does have drawbacks in addition to being less than elegant, e.g. the found set is still larger than what displays so I imagine big found sets may mess things up a bit and/or confuse users wrt. sub-hitlist navigation. But for small found sets, this should work great for folks who only know CDML. Of course, you should be able to add links to records and use dynamic values and such if you want, too, or use variations. Hope this helps some folks out there! Thanx, GC!

Don't use -lop as I had suggested unless you need to perform the OR search first for some reason.

--ST

I've not tried it, but consider performing the 'and' search while at the same time collecting the data for the 'or' search, passing that data through a token or tokens and performing the 'or'search on the results page through an inline-action which uses the token(s).

  • Author
  • Newbies

I am using php to xml-query the web companion, so then I would do it within the php script.

But yes, good point, if not a big set that's a way to go too, avoiding a javascript...

Thanks all!

amk

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.