Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

i'm sure this is simple...

Featured Replies

Hi, I know how to do a conditional formula based on whether a field equals an exact word or words by using if(field = "word" ; etc etc).

but how do you ask if you just want to pick out 1 word from a field

eg if(field [color:red]contains? "word" ; etc etc)

does that make sense?

This can be simple, if you are looking for a string: either the PatternCount() or the Position() function can be used for this.

It is not so simple when the string you are looking for must be a word in the searched text. For this, you must either know in advance which punctuation marks can be found in the text, or use a custom recursive function to check the searched text, word-by-word.

You can use the Filter function to test if it returns the word.

Check the manual on the filter function.

You can use the Filter function to test if it returns the word.

No, I don't think you can.

  • Author

If I do a find/search for the word "DOG" in a certain field in a number of records, it will bring up records where the field is "WHITE DOG", "BLACK DOG" "BIG DOG" etc

but if I do an IF or CASE formula based on the word "DOG" it won't recognise those fields with more than one word, like "WHITE DOG" etc

that's a bit strange isn't it?

It's not strange at all. The default find in Filemaker is for 'words starting with ...'. Thus "dog" finds "dog food", "white dog" and also "doggie" and "dogma" - but not "bulldog".

  • Author

Hi, what happens if you just want to look at the last word in a field of 2 or 3 words. eg look for the word "Dog" when dog is always the last word in a field. I tried using RightWords in an IF formula but it didn't work. Maybe I'm doing it wrong?

if((Field 1 = RightWords("Dog" ; 1) ; 1; 0)

I don't think PatternCount is what I need.

  • Author

so can you achieve a similar thing with an IF formula?

if((Field 1 = RightWords("Dog" ; 1) ; 1; 0)

The correct syntax for this would be =


RightWords ( Field 1 ; 1 ) = "Dog"

can you achieve a similar thing with an IF formula?

You can, but not easily - see the second part of my first post.

There's some fundamental aspects to Filemaker you may not understand, which is or was true for everyone at some point.

Case() and If() produce results when evaluated in the calculation engine. If you're putting them directly into a find request, FM interprets that as trying to find those exact strings. If you're putting them in a scripted find that uses Set Field[], FM evaluates the expression, then finds the result.

if((Field 1 = RightWords("Dog" ; 1) ; 1; 0)

This expression means:

1) Determine the Rightmost word of the string "Dog".

2) If Field one is equal to that word, return a 1, otherwise, return a 0.

In Find mode, non-global fields do not have a value so evaluating this expression in Find Mode will always return 0.

If you find a set of records who last word is a certain string, you should define a calculation field = RightWords(field;1) and then search on that field.

Edited by Guest

Here's a way to do it with a calc field. Note that not all punctuation is set up in this example, you'll need to nest more substitute functions to add additional filter characters. (Sure wish the substitute function would allow multiple Strings or characters.) Not sure if this is what your looking for.

WordFilter.fp7.zip

Sure wish the substitute function would allow multiple Strings or characters.

It does:


Substitute ( text ; [ "." ; " " ] ; [ "," ; " " ] ; ... )

  • Author

you solved my problem! that really spins me out that I had the syntax wrong. Luckily usinf RightWords solves my problem coz the key word is always on the right. If it was occasionally left or in the middle, then I wouldn't know how to pick out the key word.

cheers

Thanks comment, when I tested the list in substitue, I put all the to subs in one list, instead of adding the sub to in each, learn something everyday!

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.