Jump to content

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

Recommended Posts

Posted

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?

Posted

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?

Posted

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

Posted

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.

Posted

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.

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