By the way, what do you think this statement does? Note the %OpenId(20) at the end instead of %New(). 

#dim a,b,As Sample.Person ##class(Sample.Person).%OpenId(20)

Confusing. How about this statement?

#dim a,b,As Sample.Company ##class(Sample.Person).%New()

Do you get 3 companies or 3 persons? Does it try to "cast" persons as companies? Do you get an error at compile time or run time? Would it work if Sample.Company extends Sample.Person? More confusion...

There is no confusion.

Here's another example where the class may not even exist and yet the code compiles without errors and according to the documentation.

test.MAC

#dim a,b,As %Boolean ##class(bla.bla).%OpenId(20)
#dim a,b,As bla.bla.bla123 ##class(bla.bla).%OpenId(20)

--> test.INT

Set (a,b,c)=##class(bla.bla).%OpenId(20)
Set a=##class(bla.bla).%OpenId(20),b=##class(bla.bla).%OpenId(20),c=##class(bla.bla).%OpenId(20)

The only thing is that in this case Studio Assist will not work.

IRIS 2025.3.CE

ClassMethod test() [ Language python ]
{
  import iris

  ns = iris.system.Process.NameSpace()
  try:
    iris.system.Process.SetNamespace('%SYS')

    passenger = iris.SYS.Stats.Dashboard.Sample()
    print(passenger.GloRefsPerSec)
  finally:
    iris.system.Process.SetNamespace(ns)
}

PS: Do I need a separate python iris connection for each Namespace?

  • For each alphabetic character, determine its zero-based index in the lowercase alphabet (a-z).
  • Preserve non-alphabetic characters unchanged.

For clarify: does alphabetical characters include only the English letters a-z, A-Z, or all Unicode characters including "ªµºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéyêëìíîïðñtóôõöøùúûüýþÿ" ?

What should be the correct result for the string "Hello World µÝ Привет Мир!" ?

My current code size is 74 (where alphabetical characters only a-z,A-Z).

 
size = 74

"Hello World µÝ Привет Мир!" -> "риМ тевирП Ýµ 11100 01101!"

PS: why is the correct result in the testNumbers method 321 and not 213?

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.