2answers

Compare Lists Boolean?

I have the result in a return separated list (it came from ExecuteSQL) something like this:

DOC000000095

LNK000000080

LNK000000081

I also have another list

DOC000000081

DOC000000088

DOC000000089

DOC000000090

DOC000000091

DOC000000093

DOC000000094

DOC000000095

DOC000000096

What is a way FileMaker can say if any of the values in List 1 exit List 2 evaluate as true? I was trying to use FilterValues ( ) Inside of PatternCount () but it went sour and I forgot the whole plan.

Chris Johnston

Answers

Try this:

not IsEmpty ( FilterValues ( ~list1 ; ~list2 ) )

It returns True (1) if the intersection of the two lists is non-empty (if there are any shared values between the two lists). Note that this calculation will evaluate faster if you put the list you expect to be shorter as the first parameter to the FilterValues function.

Jeremy Bante

Here's a frist broad brush stroke.

The calculation variables could be turned into script variables and you could change the calculation result to return the actual number instead of just true (1) or false (0).

This calculation could easily be run in a loop.

By incrementing the counter variable each time, you would be testing the next value in the search list until a match is found.

If you go this route, be sure to have the right exit loop statements.

The idea would be to parse the value list (VL) with the search list (SL) for matches.

CALCULATION:

Let ( [

// Value List

VL =

"DOC000000081¶DOC000000088¶DOC000000089¶DOC000000090¶DOC000000091¶" &

"DOC000000093¶DOC000000094¶DOC000000095¶DOC000000096" ;

// Search List

SL = "DOC000000095¶LNK000000080¶LNK000000081" ;

// Determine the number of searches required.

VC = ValueCount ( SL ) ;

// Start the counter at 1 and increment.

Counter = 1 ;

// Search Term

ST = MiddleValues ( SL ; Counter ; 1 ) ] ;

PatternCount ( VL ; ST ) )

Kevin Kurpe

It is going to be interesting to see you training site when ready. Your knowledge is fabulous!

Back to questions