Using NOTIN and Lookup in the method
{
ClassMethod getEmiratesId(pHL7 As EnsLib.HL7.Message) As %String
{
SET msgType = pHL7.GetValueAt("MSH:MessageType.TriggerEvent")
IF msgType NotIn "A39,A40,O01,O11,O09,R01" {
return pHL7.GetValueAt("PID:SSNNumberPatient")}
IF msgType In "A39,A40" {
return pHL7.GetValueAt("PIDgrp(1).PID:SSNNumberPatient")}
IF msgType In Lookup("AllowsMsgTypes",HL7.{MSH:SendingFacility.NamespaceID},,) {
return pHL7.GetValueAt("PIDgrpgrp(1).PIDgrp.PID:SSNNumberPatient")}
}
}