Jump to content
Server Maintenance This Week. ×

Find & Return Words in Field


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

Recommended Posts

Hey Guys,

I'm basically looking to extract information from a field. So lets say I have a field called "Tags" and for arguments sake, let's say the field contains color string inside, IE "Red Blue Black Green Purple Orange"

Now if I wanted to check if the field contained the word "Green" within the string and if it DOES  contain it, then to RETURN that result and set it into a field somewhere? So the result of the calculation would be "Green"

 

I'm sorry if thats unclear, but I need to find a way to do this, to check for and extract a certain word from the "Tags" field which is a long string of text (different words)


Thanks in advance

Link to comment
Share on other sites

1 hour ago, hutchlad said:

check if the field contained the word "Green"

The problem with this requirement is the word "word". It is very easy to check if the field contains the string "Green", using either the PattternCount() or the Position() function. The problem is this could easily return a false positive answer if the field contains another word that contains the given string - e.g. "Evergreen" or "Greenfield".

If this is a "Tags" field, I would suggest you change it to use a return-separated list of values. That is a data type that Filemaker recognizes and provides tools to work with. You can easily test for the presence of an item in such field by doing = 

FilterValues ( "Green" ; Tags )

The result will be "Green" when Tags contain the value "Green" , empty otherwise.  The search is not not case-sensitive, but items like "Greens" or "Greeny" will not be considered a match.

 

 

Edited by comment
Link to comment
Share on other sites

Comment, a request for clarification. Perhaps I missed something.

I understand how "Greens" will not be a match, when using the return-separated list, filterValues approach.

But it seems to me that "Green" would match "Green"

Link to comment
Share on other sites

This topic is 2436 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.