August 4, 200421 yr 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
August 4, 200421 yr 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.
August 4, 200421 yr 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.
August 4, 200421 yr 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