Filemaker compare attributes

Note that I have also posted this in another forum:-

http://forums.filemaker.com/posts/019a1d406a

I am trying to build a FM12 database for a dating agency,

Each person on the database has two characteristics that they select from a drop down (e.g Honesty, Sincerity, Caring, Vareity, Intelligence).

So Person 1 might select Honesty and Vareity for their chosen values. Person 2 might choose Vareity and Sincerity. So they have one common characteristic. Essentially I am trying to count the number of common characteristics between any two people in the database.

So far whatever method I have tried has given correct values from one side of the match but not the other. E.g if I compare person 1 and person 2, when I look at person 1 from person 2's profile I get the correct result, However if I look at person 2 from person 1's profile I get the wrong result.
Kap68Asked:
Who is Participating?
 
Will LovingPresidentCommented:
One way to do this is to use the FilterValues( ) function. In FileMaker terms, "values" in a field means the content of each line in a field separated by a carriage return. So, for example, the list:

Apple
Banana
Orange

contains three values, one for each line. Using the FilterValues( ) function you can compare two lists and find the common values. You can also use the ValueCount( ) function to count the number of values in a list.

In your example, it sounds like you have five separate characteristic fields. In order to compare the characteristic lists of two people and find the common values,  you'll first need to create a calculation field that makes list of a person's characteristics  using the List( ) function. A calc field called CharacteristicList might look like this:

CharacteristicList =
     List( Char1 ; Char2 ; Char3 ; Char 4 ; Char 5 )

The calculation result of this field for one person might look like this (I'm making up some other possible characteristics since I don't know all the values in your menus) :

Honesty
Sincerity
Active
Family
Sports

Another person might have a very different list such as:

Intelligence
Quiet
Sincerity
Family
Theater

Assuming you already have a way to temporarily relate two individuals (setting a global field with the other person's ID or creating a record in an intermediary table that relates both people to each other) you can use the FilterValues( ) function to find the common traits.

     FilterValues( PersonA::CharacteristicList ; PersonB::CharacteristicList )

The result of comparing the above two lists would be:

Sincerity
Family

To count the number of common traits, use:

     ValueCount( CharacteristicList )  

which in this case would = 2

For additional information on the FilterValues( ) function, see this FileMaker Help article:

https://www.filemaker.com/12help/html/func_ref3.33.53.html

and also this more general article:

http://www.dwaynewright.com/filemaker-thoughts/2010/12/19/filter-and-filtervalues-explored.html

In addition, if you have FileMaker Pro Advanced and therefore the ability to install Custom Functions in your database, there are a number of Custom Functions that can greatly enhance your ability to compare lists. Here is one example.

http://www.briandunning.com/cf/771
0
 
Kap68Author Commented:
Thanks - I am getting closer - this has helped enormously but I seem to get strange results occassionally.
0
 
TocacarCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.