Jump to content

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

Recommended Posts

Posted

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

Posted

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

Posted

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.

Posted

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.

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