I want to open an object with a given classname and OBJID. The problem is
that I only have the classname in a %String, so not available at
compile-time. So for example:
Dim OBJID As %Integer
Dim classname As %String
classname = GetClassnameFromDB() ' Will for example be filled with
"Sample.Person"
OBJID = 1
obj = OpenId classname(OBJID) ' Does not work
In ObjectScript I've tried
obj = ##class(classname).%Open(OBJID) ' Does not work, message Class
'classname' does not exist
Of course I could go for the CSP version:
<csp:object name="obj"
classname="#(classname)#"
objid=#(OBJID)# />
This works, but I also want it outside CSP pages.
Does anyone know how to do this?
Joost
Note: I really like the $ZOBJxxx Intrinsic Functions:
http://platinum.intersystems.com/csp/docbook/DocBook.UI.Page.cls?KEY=AZOBJ
They do similar things for function calling and properties. Thank you,
Denver Braughler!