Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Complex relationships - can I use OR criteria?


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

Recommended Posts

Posted

I currently have a global field (first_name_search) which relates to a field (first_name) in another table (individuals).

If you type "Bob" into first_name_search and there happens to be a first_name = "Bob" in the individuals table, then the portal displays "Bob". This is basically used to obviate the need for Find Mode and restrict users to searching for data in certain fields.

Now, I'd like the user to be able to "search" for a first_name OR a last_name.

I could have two global fields where you type in data into first_name_search to search for a first_name or type into the last_name_search to search for a last_name - and there would be two relationships; one for first_name and one for last_name.

Surely there's a way to have a relationship which says:

first_name_search = first_name

OR

last_name_search = last_name

It seems you can only use the AND operator in defining a relationship, not an OR operator.

Any thoughts?

Posted

Hi Widey. If you multi-line the keys; that is, if you separate each search term with par.gif; it works as an OR in the relationship. Maybe you could do this:

Instruct users to use AND and OR in their "search" terms. Then build the relationship off a calc field equal to


substitute(substitute(theGlobalField," AND "," ")," OR ",":paragraph:")

It could get much more complex if there are more than two booleans -- for example, what do you do with "(Bob AND Wiley) OR Betty"? But this should give you a start.

HTH,

Jerry

Posted

Yes it's a little dissapointing that when stacking realtionships under 7.0 the separator is always AND ...well I'm at least still trying to "de morgan" me out of it looking here and there in associative- and distributive laws to get my head around it. So return delimited list or repeating fields of keys as it has been since 3.0 ...is probably the only way???

--sd

Posted

You can nest the Substitutes in 7.

Substitute( theGlobalField; [" AND "; " "]; [" OR ";

Posted

Since this is a relationship all you have to do is include the last name in the calculation field in Individuals.

Left(First Name; 1) & "

Posted

Or Left( First Name; Get(CalculationRepetitionNumber) ), a repeating calc with the desired number of repetitions.

Posted

Hi,

And then trying again I found my way through without the refresh window step, involving nested ValueListItems...

For the kind of search in this thread, the Clairvoyance technique suggested by Fenton would be more accurate, but when you're looking for exact match in 2 possible ways...

MultipleSearch.zip

Posted

Nice job! I thought you were going on vacation. wink.gif

One little tweak, make gsearchInput an auto-enter calculation with 'Do not replace existing value for field' deselected, equal to Substitute( g_searchInput; ", ";

Posted

No, it would still behave the same, but users would be forced to enter carriage returns instead of commas or some other character that is more natural to them when making a list.

Posted

I don't think this is of any practical value, but at least in theory:

blue OR red = not (not blue AND not red)

It escapes me what "de Morgan"'s rule has to do with it. It's another issue here since 1NF dictates atomicity of a table where ugo's template with JT's tweak denormalizes by allowing both name and surname be written next to each other in the same field.

lets se what the truth table says:

A | B || A + B

0 | 0 || 0

0 | 1 || 1

1 | 0 || 1

1 | 1 || 1

....Where XOR is identical except for last line where the result is 0, and if you type in the intire name of a person no related records exists.. JT's tweak encourage the user to type an entry which should have been validated against in the first place. But some issues are tough to handle via a validation - because some naming conventions allow ...say O'Brian or de Morgan you indirectly were hinting at repesents challenges to the developer....

--sd

Posted

I was referring to something you said earlier:

it's a little dissapointing that when stacking realtionships under 7.0 the separator is always AND

Of course "a OR b" is possible within Find (multiple requests) and over a single relationship (multiline key).

But, as you said, when "stacking relationships", you're stuck with AND.

In theory, one could convert an OR statement into an AND statement (using de Morgan's laws) but, as I said, I doubt it would yield practical benefits.

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