Question Ahmad Bukhtiar · Sep 23, 2020

Using NOTIN and Lookup in the method

Any syntax help, i want to check different msg types and then reach out to the value in that particular segment. Here is example, i want to get SSNNumber from a method. Trying to use NOTIN, and Lookup

Class Training.RulesFunctionSet Extends Ens.Rule.FunctionSet

{

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")}
}
}

Comments

Adrian Zeeman · Sep 23, 2020

You can use the contains operator "["

IF ",A39,A40,O01,O11,O09,R01,"'[(","_msgType_",") {
return pHL7.GetValueAt("PID:SSNNumberPatient")}

0
Adrian Zeeman  Sep 23, 2020 to Ahmad Bukhtiar

I'm not sure about the lookup syntax, I haven't used it.

The code that I sent is not contains. It has an apostrophe in front of the open square bracket. If you want to check if it's contained in the list it will just be a open square bracket 

0
Robert Cemper · Sep 23, 2020

"NotIn" is not part of InterSystems ObjectScript. Also not "in" . This is SQL slang
Alternative to the proposal of @Adrian Zeeman  you may try this construct:

if '($LF($LFS("A39,A40,O01,O11,O09,R01"),msgType) { . . . 
0