A FMT Preferred FileMaker Consultant - Developer
Log in
Hot & Trending on FMT

FileMaker - Improved PatternCount Searches

Featured FileMaker - Improved PatternCount Searches

In FileMaker, you sometimes need to perform a PatternCount on a list (e.g. to check if a specified value appears in a specified list). The expected method would look something like this:

    PatternCount ( List ( RelatedIDField ) ; RequiredValue )

e.g.

    PatternCount ( List ( cListOfJobIDs ) ; “JOB11333” )

However this will easily fail if you are looking for explicit values since PatternCount only concerns itself with whether a supplied search value exists within another supplied value (e.g. a PatternCount for JOB11 will be found in JOB11333).

To get around this you can alter your code to this:

    PatternCount ( List ( RelatedIDField ) ; RequiredValue & “¶” )

e.g.

    PatternCount ( List ( cListOfJobIDs ) ; “JOB11333¶” )

This adds a terminator so we can include it as part of the search value but will fail if there is only one value in the supplied list, since it won’t end in a carriage return.

A neat solution is to wrap both the list and the search value in carriage returns thus:

    PatternCount ( "¶" & List ( RelatedIDField ) "¶" ; "¶" & RequiredValue & "¶" )

e.g.

    PatternCount ( "¶" & List ( cListOfJobIDs ) "¶" ; "¶JOB11333¶" )

Now it no longer matters if there is one or 100 values in the provided list.

iGeek

Looking to improve your workflow or just upgrading your systems? If you're striving to transform your business efficiency then FileMaker may just hold the key.

The unique power of FileMaker combines real flexibility with number-crunching ability, enabling solutions to be built that are made to measure and powerful.

We produce highly advanced FileMaker solutions that fit your workflow, leaving you to run your business while FileMaker takes the strain.

Users at all levels of the business can access data and reports in real time, resulting in an increase in productivity and a reduction of cost.

We harness the processing power of FileMaker to bring you systems hand-developed to simplify and empower business processes. With a host of possible uses, FileMaker can be relied upon to improve efficiency in virtually any area.

Website: www.igeek.co.uk/