Question
· Jan 21, 2016

[SOLVED (KIND OF)] Missing something obvious trying to do a lookup in a method

So calling this lookup manually from the console works as expected:

PHR>set key = "WMMC_IMM"
PHR>w ##class(Ens.Util.FunctionSet).Lookup("BlockFeed",key)
1

 

However, calling it from a method with some concatination to build the key is giving me problems:

ClassMethod canSendToState(iParticipant As %String, iFeed As %String) As %Boolean
{
    set = iParticipant _ "_" _ iFeed
    w "Looking up " _ k,!
    set = ..Lookup("BlockFeed",k,"not found")
    w "x = " _ x,!
}

 

PHR>w ##class("Custom.MHC.Common.Functions").canSendToState("WMMC","IMM")
Looking up WMMC_IMM
x = not found

 

I really don't understand.  X should be 1 

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

so I set iParticipant and iFeed manually in the console then literally pasted the contents of the method to the console and it works.

 

PHR>set iParticipant = "WMMC"
PHR>set iFeed = "IMM"
PHR>set k = iParticipant _ "_" _ iFeed
PHR>w "Looking up " _ k,!
Looking up WMMC_IMM
PHR>set x = ##class(Ens.Util.FunctionSet).Lookup("BlockFeed",k,"not found")
PHR>w "x = " _ x,!
x = 1


Can anyone explain why?