Class dc.test Abstract ]
{

ClassMethod Test()
{
  #dim ex As %Exception.AbstractException
  #dim xDataStream As %Stream.Object
  #dim mydoc As %XML.XPATH.Document

  try{

    set xDataStream=##class(%Dictionary.CompiledXData).IDKEYOpen(..%ClassName(1),"ClinicalDocXData").Data

    $$$ThrowOnError(##class(%XML.XPATH.Document).CreateFromStream(xDataStream, .mydoc,,,,,"s urn:hl7-org:v3"))
    $$$ThrowOnError(mydoc.EvaluateExpression("//s:entry/s:Id""text()", .tRes))

    for =1:1:tRes.Count() {
      write tRes.GetAt(i).Value,!
    }    

  }catch(ex{
    write "Error "ex.DisplayString(),!
  }
}

XData ClinicalDocXData
{
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MainDocument xmlns="urn:hl7-org:v3">
  <realmCode code="IT"/>
  <title>kjbkjkjbkjb</title>
  <effectiveTime value="20090905150716"/>
  <versionNumber value="1"/>
  <component>
    <body>mhvjhjkvhj</body>
    <component>
      <section>content</section>
      <ID>5</ID>
      <title>Certificato</title>
      <text/>
      <entry>
        <Id>5</Id>
      </entry>
      <entry>
        <Id>6</Id>
      </entry>
    </component>
  </component>
</MainDocument>
}

}

Result:

USER>do ##class(dc.test).Test()
5
6
 
TEST.TEST.cls

That's what I get:

   

PS: Have you tried rebuilding the cube?

As you can see, the author asked two questions:

  1. In some cases, it's necessary to manipulate data from one namespace to another. For example, a routine in the "N1" namespace needs data from the "N2" namespace.
  2. In the same context, how could I make a persistent class global for all namespaces? The only way I know is by putting it in %SYS.

What would be the best practices for these use cases?

I answered the second question, and the other participants answered the first.

Both.

Just for understanding. Will the result change if the conditions are reversed?
For example:

$SELECT(
%source.userActionfourteen=1:"User action fourteen",
%source.userActionthirteen=1:"User action thirteen",
%source.userActiontwelve=1:"User action twelve"%source.userActioneleven=1:"User action eleven"%source.userActionten=1:"User action ten"%source.userActionnine=1:"User action nine"%source.userActioneigth=1:"User action eigth"%source.userActionseven=1:"User action seven"%source.userActionsix=1:"User action six"%source.userActionfive=1:"User action five"%source.userActionfour=1:"User action four"%source.userActionthree=1:"User action three",
%source.userActiontwo=1:"User action two",
%source.userActionone=1:"User action one", 1:"Other")

I agree.

$CASE(1,
%source.userActionone:"User action one"%source.userActiontwo:"User action two",
%source.userActionthree:"User action three",
%source.userActionfour:"User action four"%source.userActionfive:"User action five"%source.userActionsix:"User action six"%source.userActionseven:"User action seven"%source.userActioneigth:"User action eigth"%source.userActionnine:"User action nine"%source.userActionten:"User action ten"%source.userActioneleven:"User action eleven"%source.userActiontwelve:"User action twelve"%source.userActionthirteen:"User action thirteen",
%source.userActionfourteen:"User action fourteen", :"Other")

But the result will still be only one value, even if all %source.userActionXXX=1.

I will assume that you are using "Normal" (in which the user _SYSTEM is turned off) or even "Locked Down" (the user "UnknownUser" has no roles at all): Initial User Security SettingsDOC

I'm using "Locked Down", IRIS 2025.2CE and ran into a lot of different bugs when using WebTerminal v4.9.5:

  • <PROTECT>endSession+25^%SYS.cspServer
  • <LICENSE LIMIT EXCEEDED>
  • etc.

Fortunately, the WebTerminal source code is available for analysis and editing.

The problem can be solved in two ways: either fix the source code or add the missing role. I chose the latter.

In my case, it is enough for the web application /terminalsocket to add the %Admin_Secure role in addition to the existing roles. After that, it doesn't hurt to clean up all existing sessions:

kill ^WebTerminal("AuthUser")

If the <LICENSE LIMIT EXCEEDED> error persists after this, restart the IRIS instance.

PS: Advisory for IRISSECURITY in InterSystems IRIS 2025.2