• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1290
  • Last Modified:

Filemaker text function PatternCount

Can PatternCount(text;searchString) be invoked on a carriage return separated list of numbers, or does the text have to be a string? If the latter, will it work to use GetAsString to convert a list of numbers to a string? I want to search a field populated with a list of numbers for any occurrence of the numeral 3.
0
MarkJulie
Asked:
MarkJulie
  • 2
1 Solution
 
Will LovingPresidentCommented:
PatternCount() will search the entire field regardless of the number of carriage returns. There is also a similar function called ValueCount() which can search a return separated list of values for a matching value. For example, if you have the list:

236
222
893
999
687

For PatternCount( myList ; "3" ) you would get 2 as the answer.
For ValueCount( myList ; "3" ) you would get 0 as the answer.
For ValueCount( myList ; "893" ) you would get 1 as the answer.

Further, the Custom Function PositionValue will give the position in return separated list of a particular value.

http://www.briandunning.com/cf/62

PositionValue ( myList; "893"; 1; 1 ) = 3

0
 
MarkJulieAuthor Commented:
Does ValueCount require a string of the same length to match (i.e., no substrings)?
Would PatternCount( myList ; "89" ) return 1?
I also assume using GetAsText(myList) is unnecessary?
Thanks for the Brian Dunning link.
0
 
Will LovingPresidentCommented:
ValueCount looks at the entire string in each value, i.e. each carriage return separated value, so it has to match the entire 'value' up to the carriage return.

Yes, PatternCount( myList ; "89" ) would return 1. PatternCount( myList ; "2" ) would return 4.

I'm not 100% positive about the GetAsText() being unnecessary but I'm pretty sure ValueCount() treats even a number fields as text for this purpose because it is a "text" function. Easiest way to find out would be to test. The one important test would be to check for leading zeroes since a number field generally ignores them but a text field does not.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now