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.

Mixing AND + OR logic with Custom Web Publishing

Featured Replies

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?

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

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!

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

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.

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

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.