Question
Eduard Lebedyuk · Mar 2, 2019

Get concrete class from id

I have one abstract class and several subclasses. All share one data/id global.

How can I get concrete class name from id (without opening the object)?

What I have so far:

write $p($lg(^DATAGLOBAL(<id>),1),"~",*-1)

It does the job, but is there a more official way?

00
0 0 3 171

Replies

OID contains the class name. So this should do it.

write $li(##class(Abstract.Class).%ComposeOid(id),2)

 

Thank you Robert. That's exactly what I was searching for.

I just realized that this method doesn't check the existence of the ID.

therefore:

write:##class(Abstract.Class).%ExistsId(id) $li(##class(Abstract.Class).%ComposeOid(id),2)

or any equivalent construct.