I am using patterncount but it only works on the first item in the value list.
What makes you say that?
PatternCount ( "pdf¶doc¶xls" ;"doc" ) = 1
And your title says “count occurrences”, but the text reads “exists at least 1 time”. What is it to be?
Take a look at the
FilterValues ( textToFilter ; filterValues ) function.
Pass the list as the first parameter.
If it returns an empty result, it means no such value in list.
The values in list must exactly match the filter! meaning:
filter = app will not return Apples
filtervalues works a treat..
so I have
if not (isempty(FilterValues ( FILE_UTILITY::FILE_TYPES ; RightValues ( Substitute ( $$file ; Char (46 ); "¶" ) ; 1 ) ))
Another way to test is
Field = Substitute(Field; "." & extension; "")
if the field remains the same, it means it did not contain the extension at all.
Build a scripted search based on your value list, which is what I assume your intent is.
ie, you have an unknown list of file extensions stored in the list and you want to search something for at least one of those extensions. Such as does the table contain any of the list items in a particular field.
The script below shows how to built a find using a loop. Be careful not to build a gigantic find...
What this does is what I think you are asking for. It takes your list and searches a table field for each item in the list using the new record function in the find just as you would manually do a find and use new record.
I decided to create a script to do this since your idea will be useful in my current project.
There may be alternatives.
The other choice is a second interpretation of your request, does X exits in list Y which may be what you are looking for.