Jump to content
Server Maintenance This Week. ×

combining the and and or operator in a request?


This topic is 7367 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 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?

Link to comment
Share on other sites

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

-----

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 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

Link to comment
Share on other sites

This topic is 7367 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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