June 8, 200520 yr 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?
June 8, 200520 yr 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.
June 28, 200520 yr 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!
June 29, 200520 yr 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
June 30, 200520 yr 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.
June 30, 200520 yr 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