Question Alexandr Ladoshkin · Apr 4, 2017

Exclude system globals

Hello everyone. I have some problem with selecting my own globals from namespace. My task is select only globals created by me.  Follow my code, I get all globals from given namespace. 

SET NAME="" F  SET NAME=$ORDER(^$GLOBAL(NAME)) QUIT:NAME=""  DO

Please help me with excluding system globals. I need work only with my own globals.

Comments

Timothy Huggins · Apr 4, 2017

You could use  the %SYS.GlobalQuery NamespaceList query instead - there is a parameter to include/exclude system globals.

rs=##class(%ResultSet).%New()
rs.ClassName="%SYS.GlobalQuery"
rs.QueryName="NameSpaceList"
sc=rs.%Execute($namespace,"*",0)

0
Evgeny Shvarov · Apr 4, 2017

Hi, Alexandr!

If you mean "System" as starting with "%" you can use the following:

SET NAME="" F  SET NAME=$ORDER(^$GLOBAL(NAME)) QUIT:NAME=""  DO:($E(Name)'="%") 

0