Jump 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.

If (field contains "text";1) - quick question

Featured Replies

How do I write this script. I want to count the number of records that contain in a field a certain word from a phrase. For instance if the record for the field "Medication" is "patient received heparin and coumadin" I would like to count number of patients that received heparin.

If (Medication contains "heparin";1)

this does not work and neither does

If (Medication = "heparin";1)

Any thoughts

Thanks

Yes.

I suggest you use the formula:

Min(1; PatternCount(Medication; "heparin"))

...which will return a 1 if there is one or more occurrences of 'heparin' in the Medication field, but will return a zero if 'heparin' is not present. wink.gif

you want

Case (PatternCount(Medication, "heparin"); 1)

Realize that this will give you one field per record that will be 1 if this field contains "heparin".

You should then have a summary field that will be the sum of this field.

Also realize that this will be case sensitive (ie it won't also count the records that contain "Heparin"). If you don't want this, use

Case (PatternCount(Lower(Medication), "heparin"); 1)

Also realize that if you use a summary field you will get the count for the current found set and not the whole table.

Scott Quiring wrote:

Also realize that this will be case sensitive (ie it won't also count the records that contain "Heparin")...

This is in fact incorrect. The PatternCount( ) function is not (and never has been) case sensitive.

Create an account or sign in to comment

Important Information

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

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.