Dynamic/SQL Drop down list for Business Operation Property Setting
Hi, I’m trying to setup a Business Operation where the Property is a drop down list of Strings. I was able to produce the desired effect but only using a hard coded list like Property LookupProp As %String(VALUELIST = ",value1,value2"). Instead I would like it to be populated from lookup table so I created a method to use SQL to fetch the result set from a Lookup table and then return it as the desired string. But doesn't allow me to do declare the property using the method like this: Property LookupProp As %String(VALUELIST = ##class(MyClass).GetLookupValues());
ClassMethod GetLookupValues() As %String
{
SET keyQuery = "SELECT DataValue FROM Ens_Util.LookupTable WHERE TableName = 'KeyLookup' order by DataValue"
write !,keyQuery
SET tStatement = ##class(%SQL.Statement).%New()
SET qStatus = tStatement.%Prepare(keyQuery)
IF qStatus'=1 {WRITE "%Prepare failed:" DO $System.Status.DisplayError(qStatus) QUIT}
SET pOutput = tStatement.%Execute()
// do pOutput.%Display()
set tReturnList = ""
WHILE pOutput.%Next() {
// write !,"pOutput.DataValue "_pOutput.DataValue
// set $LIST(tReturnList, *+1) = pOutput.DataValue
set tReturnList = tReturnList_","_pOutput.DataValue
}
return tReturnList
}
Is there some way to do this?
Thanks in advance!