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.

complex find, any ideas?

Featured Replies

I need to do a complex find that combines a Logical Operator and request with a Logical Operator or request. I need to be able to find records that are marked "must read" in one field, and marked "07" or "09" or "04" in a second field. Is this even possible? Or am I stuck with separate links for each value in the second field?

Logically this would be expressed thusly:

Field1="must read" and Field2="07"

or

Field1="must read" and Field2="09"

or

Field1="must read" and Field2="14"

If I remember my Boolean algebra, the shorthand would be somthing like

"must read"."07" + "must read"."09" + "must read"."14"

So I guess the CDML code will have to look something like:

FMPro?-db=...&-lay=...&-Format=...&-Error=...&Field1=must%20read&Field2=07-Lop=OR&Field1=must%20read&Field2=09-Lop=OR&Field1=must%20read&Field2=14&-Find

I haven't tried to do any fancy finds through CDML like this, so let me know how it goes.

Keith, you've looked long and hard at this stuff: does it look right?

"I need to be able to find records that are marked "must read" in one field, and marked "07" or "09" or "04" in a second field.",

The first thing I did was go to my pedigree database and the format files I made last week. Then, using the form action example from the cdml reference I wrote into the appropriate format file the form action :

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

<input type="hidden" name="-db" value="performance">

<input type="hidden" name="-lay" value="everything">

<input type="hidden" name="-format" value="found.htm">

<input type="hidden" name="-error" value="omygaw.htm">

<input type="hidden" name="-lop" value="or">

<input type="text" name="dam" value="Beauty_Sleep Lakeland_Beauty">

<!--a lot of stuff from FMI is greatly lacking in elegance, as is this hard-coded example-->

<input type="submit" name="-find" value="get all dams">

</form>

It worked as I thought it would, which is why I don't use the -lop (and I don't use the -op) in my form and link acitons. The -lop "or" works as an "and" in that it returned records for both Beauty Sleep and Lakeland Beuaty.

I question if the need is to find the records (a simple search of two fields) or to display the found records in a way which could be handled by fmp-if / fmp-elseif conditionals on the found.htm.

Unfortunately, you can not mix '-lop' operators. The alternative way is to find:

'-lop=or&field2=07 09 04&-find' then use [FMP-If:field1.eq.must read]

Hope this helps.

Garry

If I read this correctly, "... find: '-lop=or&field2=07 09 04&-find'..." the 04, 07, and 09 are being hardcoded, which precludes the client making the selection.

  • Author

I guess my answer is that you can't mix logical operators. I'll have to use an FMP-If statement that shows only the must read items. And yes, this find is hard coded, though it is variable by record. I am developing a registration database for a school. Parents login and see the information for their students and can edit their contact information in our database. The students are listed in a portal, so I am using an [FMP-Portal] tag to display the necessary find criteria.

They do not need to be 'hard-coded'.

Garry

Well I've certainly enjoyed this exercise. Having experimented more than I had in the past with the logical operators, I've come to a better understanding of how they work. I believe I can state it rather succinctly.

First, read the examples in the cdml reference. To help you understand the differences test the two operators by writing the code and running it as a test*. Note the subtle difference of syntax for submission of the field data between a form aciton and a link action.

Second, the logical operator 'or' acts like an 'and' in that it WILL NOT find EITHER this record OR that record, but rather it finds this record AND that record. It's true value is that it acts as the db instruction, 'Modify Last Find', in that it allows, with proper syntax, the submission of multiple entries in the same field, which results in each finding a different record. The logical operator 'and' is the default logical operator. Essentially it is an unnecessary tag to use in any code. Any -find not using 'or' can be written without using the -lop ="and"'.

Third, you cannot mix logical operators. However you can 'stack' or combine the 'or' operator. For instance form action code such as:

<input type="hidden" name="-lop" value="or">

<input type="text" name="dam" value="Beauty_Sleep Lakeland_Beauty">

<input type="hidden" name="-lop" value="or">

<input type="text" name="damsire" value="Exceller Ribot">

will find the the records for both dams (Beauty Sleep and Lakeland Beauty) and for both damsires (Exceller and Ribot).

____________________

*For my own enlightenment I keep several db's and format files which I made for testing purposes and which I can easily amend for a variety of tests and which tests will not interfere with anything.

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.