Jump to content
Sign in to follow this  
igeek UK

Improving PatternCount searching

Recommended Posts

Fitch    148

The technique described is OK, but we've had FilterValues since FileMaker 7.


Rather than:

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

You can do this:

FilterValues( List ( related::JobIDs ) ; "JOB11333" )

The result will be the text you searched for, rather than a boolean. You can then test for IsEmpty.


Another nice thing about FilterValues is that you can test for multiple values at once.


PS: your original formula was missing that second ampersand.

PPS: note that single pilcrows no longer need quotes since FileMaker 7.

PPPS: it seems likely that cListOfJobIDs is already a list, so you wouldn't wrap it in a List function.

  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Who Viewed the Topic

    1 member has viewed this topic:
  • Similar Content

    • By Rasse
      I have portal with related records.In portal row record I need find specific text (patterncount) from a field and sum up that records cost field. How do i do that? Do I need to do a loop every portal row and use patterncount to check correct record and sum that record cost field($costs = $costs + table::cost)?
      Thank you for your help.
    • By hutcheedingo
      I've been trying to write a Custom Function that will give me a list of unique combinations between two occurrences of the same list.
      The nearest I've come is with this Function, using the following list as an example 1,2,3,4
      ListCombinations ( listofValues ; separator )
      Let([ listLength = ValueCount(listOfValues); lastValue = GetValue(listOfValues; listLength); lesserList = Case( listLength > 1; ListCombinations(LeftValues(listOfValues; listLength -1 ); separator); "") ]; Case( listLength = 0; ""; listLength = 1; RightValues(listOfValues; 1); /* Ensures ¶ at end */ lastValue & "¶" & lesserList & /* already terminated by ¶ */ Substitute(lesserList; "¶"; separator & lastValue & "¶") ) )   The output comes out looking like this: 4
      1 | 2
      2 | 3
      1 | 3
      1 | 2 | 3
      3 | 4
      2 | 4
      1 | 4
      1 | 2 | 4
      2 | 3 | 4
      1 | 3 | 4
      1 | 2 | 3 | 4
      What I want is for the output to be limited to only the 2 number values, shown below.  I've had a play with the Function, but I think I've been looking at it too long and can't make hide nor hair of what I need to change to produce the below list   
      1 | 2
      2 | 3
      1 | 3
      3 | 4
      2 | 4
      1 | 4
      Thank You for An Help in Advance  
    • By bcolburn

      I'm trying to search a large text field that contains a list of medications to see if any one of a large list of more specific drug names is listed. I have a second field with different classes of drugs and we are trying to both: 1.) get a list of specific drugs being taken and 2.) see which classes the drugs belong to.

      My idea was to use patterncount() on the list of actual medications and make a calculation field using case() to check off the drug classes based on the contents of the medication list. I am having trouble figuring out quite how to do this because it seems my search string would need to contain multiple words with an "or" relationship (i.e. if the field contains Drug A OR Drug B OR ... but I am aware that Patterncount will only search the specific string order I use to define the calculation (I think).

      Do you have any ideas on a good way to accomplish this? If patterncount() is the way to go, how would I structure the command to search for ANY of the words and not ALL of them? If it's not the right function, which one should I be using? Thanks for your help!

    • By Daniel Wood
      If you have spent any time developing in FileMaker, or programming in almost any language, you will be familiar with the concept of a loop. When scripting your loops you probably have a favorite method that you use. This article presents and compares a number of looping techniques that can be used in FileMaker in an attempt to locate the fastest method…

      Read the Full Article Here…
    • By Daniel Wood
      Pretty much everything in FileMaker comes with some form of comment box to let you add more information - such as fields, menus, custom functions, calculations, scripts, and the graph. However the one area lacking in a comment box is value lists, unless that is, you think a little outside of the box…

      Read the Full Article Here…

Important Information

By using this site, you agree to our Terms of Use.