Question
· May 10, 2017

List out unchecked mapped items classes through terminal?

Hi,

I would like to list out unchecked mapped items ( classes in management portal )  classes of a particular namespace. Is there any code or terminal command which i can use ?

I am able to list out classes of namespace . But I need to list out unchecked mapped items classes

do ##class(%SYSTEM.OBJ).GetClassList(.result)

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

Please explain what you mean by "unchecked".

As for "mapped", the following may give you what you seek.

For classname, e.g. %Library.String, this expression will return true (1) if the class is mapped from a database that is not the default code database for the current namespace:

##class(%SYS.Namespace).GetGlobalDest(,"^oddDEF",classname)'=##class(%SYS.Namespace).GetGlobalDest(,"^oddDEF")

There is no command like utility that I know of to do this.

Classes are compiled down to routines and there is a command line utility for listing these...

Do ^%RD

Whilst there is no utility, you can write your own that queries the %Dictionary.CompiledClass, e.g. in SQL you can do...

select * from %Dictionary.CompiledClass


There is also a quick and dirty way to list from that storage class using the following from the command line...

set cn="" for  set cn=$order(^oddCOM(cn)) q:cn=""  if $e(cn,1)'="%",$e(cn,1,3)'="Ens",$e(cn,1,2)'="HS" write !,cn


*Its a one liner but it's wrapping on the comments (cut and paste it into terminal as one line).

Its a bit of a hack, but it should work. I have put a filter in so that it does not list system classes that I can think of, you might want to tinker with this to fit your needs. Remember to honor the spaces (there are two after the for and two after the quit).

WARNING

You mentioned that you have created three classes in the %SYS namespace.

Be careful doing this as you can lose your code doing an upgrade.

If you want to have common code that is accessible from all of your other namespaces then it is better to create a common namespace and then map that namespace to the others.

Sean

If you don't mind working a the global level, here's a way of enumerating the classes that are stored in the default code database of a namespace:

USER>s namespace="%SYS"                                                          
USER>s impliedNamespace="^"_##class(%SYS.Namespace).GetGlobalDest(namespace,"^oddDEF")
 
USER>w impliedNamespace
^^c:\intersystems\ens171\mgr\
USER>s className="" f  s className=$o(^|impliedNamespace|oddDEF(className)) q:className=""  w !,className