Jump to content

This topic is 5508 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

I have a field that contains a variety of data. I need to know the format for a function that would evaluate the field for the text string that is somewhere in the field (not exclusive) but is within the field. If the string is present within the field, than "x" if not than "y"

  • Newbies
Posted (edited)

By "not exclusive" I'll assume that the text string you are searching for may or may not appear in the field. So in A number of records you will have (A - B ) records where the text appears (B being the number of non-occurances).

The IF and POSITION functions will certainly give you your X or Y results.

Edited by Guest
Posted

The IF and POSITION functions will certainly give you your X or Y results.

Point is - so will PatternCount() as Comment suggested and Case() can be used as well.

Case ( PatternCount ( text ; "this" ) ; "x" ; "y" )

All that needs to happen is to produce a boolean true (1 or greater). It doesn't matter how many times the "this" would appear.

I believe that JT (-Queue-) once conducted a study over the speed differences between PatternCount() and Position(). He supposed Position() would be faster because it didn't have to count all instances and would stop when first instance was found whereas PatternCount() would need to evaluate the entire field before returning a result. I don't recall his results offhand but I think he was surprised that his supposition didn't necessarily hold true.

Posted

I believe that JT (-Queue-) once conducted a study over the speed differences between PatternCount() and Position(). He supposed Position() would be faster because it didn't have to count all instances and would stop when first instance was found whereas PatternCount() would need to evaluate the entire field before returning a result. I don't recall his results offhand but I think he was surprised that his supposition didn't necessarily hold true.

I'd love to see those results if you're able to dig up the link.

Posted

I will look for that thread over the holiday, Tom. Truth is ... spending some of my holiday reviewing JT's threads sounds fun to me. :wink2:

  • Newbies
Posted

Point is - so will PatternCount() as Comment suggested and Case() can be used as well.

Much earlier FMP versions had problems with imbedded multiple IF statements and Case was introduced to address this. Didn't think to replace IF with CASE for a single occurance - thanks for that!

As for PatternCount - I can't recall ever having to use it - but then most of the FMP work I have done to date has had little text processing involved. Recently I had to devise a function to extract email addresses from "bounce backs" (dead) so a client could update their records after they sent their regular newsletter out. So, after some experimentation, CASE, MIDDLE and POSITION did the job on the bulk (about 99%) of the bounce backs.

I can see that text processing is going to become more and more of a requirement - interesting times ahead :

This topic is 5508 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

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