rubinjm

calc field to assign categories based on text field

Discussion created by rubinjm on Dec 22, 2016
Latest reply on Dec 22, 2016 by jfletch

I have a list that includes a text field with the name of various police departments, rescue squads and fire departments. I'm trying to create a calc field that looks at the name in the text field and assigns a category like police or EMS. Here is what I'm using but it is not working consistently. For example, it works correctly for "rescue" and "police" but isn't working for "fire." What am I doing wrong?

 

 

---

Case ( PatternCount ( MEANS OF ARRIVAL ; "ambulance" ) ; "EMS" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "taxi" ) ; "SELF" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "blank" ) ; "UNKNOWN" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "flight" ) ; "FFL" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "police" ) ; "POLICE" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL  ; "rescue" ) ; "EMS" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "car" ) ; "SELF" ) ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "fire" ) ; "EMS" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "MEDEVAC" ) ; "EMS" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "vehicle" ) ; "SELF" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "bus" ) ; "SELF" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "EMS" ) ; "EMS" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "LIFESTAR" ) ; "EMS" ;

 

Case ( PatternCount ( MEANS OF ARRIVAL ; "self" ) ; "SELF"

 

)))))))))))))

Outcomes