Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Mixing AND + OR logic with Custom Web Publishing


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

Recommended Posts

Posted

I am new to filemaker. I have created a simple database. Using the site assistant, I have created XSLT templates for a search page. I want the search to require all matches. That was simple. I added this line:

<input name="-lop" type="hidden" value="and"/>

Everything is working great, except for one thing. I have a set of checkboxes for the field 'CITY', and within the checkboxes I want to use OR logic, so that people can search on 'Washington' OR 'New York' OR 'Seattle', etc.

I have tried many approaches. Scripting, for example. But I can't see how to pass arguments to FM scripts.

Does this make sense? Does anyone have an answer?

Posted

You can't mix AND and OR logic in the query. This is one of the drawbacks that has is origin already in the CDML times.

And you can't pass arguments to scripts.

Maybe there is a way with by intersecting two XML result tree sets.

  • 3 weeks later...
Posted

I've had to create some weird workarounds. Maybe you will too! Calculated fields equal to the same field for multiple searches, fields formatted with value lists with one value, and it's has been so long, I've forgotton the other work arounds.

Perhaps a scripted query is needed?

Sorry, I couldn't be more help! This is a known issue (unable to mix the -lop) with CWP. Think around it is all we can do!

Posted

Here's a litte example (just with some fake addresses) that shows how one could mix AND and OR searches.

It goes along the following ideas:

- Don't do search in the first instance, but add the query to a Metasearch table.

- Read out the Metasearch table and create two queries in document() calls, one with -lop=or and the other with -lop=and, querying the Address table. The results are stored in two variables.

- Intersect the two result sets in a xsl:for-each loop by using the record ids of set 1 as an index to the records in set 2.

andor.zip

Posted

That's really a study example. For a productive system, I would have:

- placed the Metasearch table into a separate file and made only this file writable

- programmed additional tests in andor_results.xsl that ensure that the result sets do not get too large

- added some logic for counting the records in the final result set

- added some logic for sorting the records with xsl:sort

- added some logic to save the result set in a session for further processing

CWP with XML/XSLT is really strong, and I have the feeling that its potential is underestimated.

Posted

Yes! I just downloaded the example, so haven't a comment. But this is indeed "thinking around the problem"!!

The document() feature is very powerful and may be the key to the lack of mixed logic searches. Since XSLT is so new (relatively) to us all, we'll find that very cool ways will evolve (eventually). :)

This topic is 7087 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.