What do you mean by 'comparing'? If you merely need to know if one is different in any way from another, you can just use the ValueListItems() function for each, testing their equality. Be mindful of using that function in a stored calculation, as it can create very large indices, particularly with large value lists. Better, if your situation allows it, to use a script that sets two variables to the lists' contents, and then test the equality of those variables.
If you want to know which is longer, you can just count the returns. But if you want to know exactly how their contents differ, you will need to either use a script that walks through each, comparing them line by line, or a recursive custom function that does something similar. Such a script would set a counter to a starting number (zero or one, depending on how you parse the lists), and then run a loop that parses out one line of each list with each increment of the counter, putting the results of each parsing into a separate script variable. Whenever the two variables do not match, their contents can be captured and appended to a list (another variable or global field), so that you might end up with something like: 3 apple <> orange 7 peach<> pear The number on the left would be pulled from the counter (perhaps adding or subtracting 1, depending on how you start the counter and how you're parsing the lists), and indicate the list row number. That will still not tell you if 'peach' does actually appear in the second list, but on a different line. In other words, if the answer to the question 'what do you mean by "comparing"' is that you want to know whether or not the overall contents are the same, even if the order is not, then you will need a more elaborate version of what I described above, where you walk the lists and compare the values in each line. In this harder case, you would need to check the variable-- the contents of one line in one list-- against a PatternCount() for it in the other list. Depending, again, on the full answer to my original question, you may need to run that comparison twice, once for each list. And that will get harder still if you may have comparisons like 'apple' and 'apple pie'. In that case, PatternCount() would return a positive value for looking for 'apple' in a list containing 'apple pie', but not the other way 'round. John Weinshel Datagrace Vashon Island, WA (206) 463-1634 Member, FileMaker Business Alliance Certified For FileMaker 8 Certified For FileMaker 7 -----Original Message----- From: FileMaker Pro Discussions [mailto:[EMAIL PROTECTED] On Behalf Of Chuck Pelto Sent: Saturday, July 05, 2008 9:26 AM To: [email protected] Subject: Comparing Value Lists Does anyone have a good methodology for comparing two different valuelists? Regards, Chuck
