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.

 

 

Answers

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)

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)'="%")