Question
· Jan 21, 2016

Not sure why I'm getting this error

Here is the function I'm writing:

/// Returns the participant code based on MSH-4
ClassMethod getParticipant(iSendingFacility As %String) As %String [ Final ]
{
   set = $PIECE(iSendingFacility,"^",1)
   set = $PIECE(iSendingFacility,"^",2)
   set sc1 = Lookup("ParticipantCodeMap",a)
   if sc1 = "" {
      set sc1 = Lookup("ParticipantCodeMap",b)
   }
   q sc1
}

For some reason when I try to run it I get the following error:

 set sc1 = Lookup("ParticipantCodeMap",a)
 ^
<UNDEFINED> 

I tried adding the the default parameter in case it's not finding it but it didn't help.  What am I missing?

Discussion (5)0
Log in or sign up to continue

I guess that you writing an function for rule.  And your class where you do it extends  Ens.Util.FunctionSet  where Lookup is located. Lookup is a method and you should call it as a method, now it is as variable.

 
/// Returns the participant code based on MSH-4
ClassMethod getParticipant(iSendingFacility As %String) As %String [ Final ]
{
   set = $PIECE(iSendingFacility,"^",1)
   set = $PIECE(iSendingFacility,"^",2)
   set sc1 = ..Lookup("ParticipantCodeMap",a)
   if sc1 = "" {
      set sc1 = ..Lookup("ParticipantCodeMap",b)
   }
   sc1
}
 

And if you want to call it by terminal, it should be so:

 write ##class(Ens.Util.FunctionSet).Lookup("ParticipantCodeMap","1083601330")