Simple sample:

Class dc.test Extends %ZEN.Component.page
{

XData Contents [ XMLNamespace "http://www.intersystems.com/zen" ]
{
<page xmlns="http://www.intersystems.com/zen">
  <tablePane
    id="tp"
    sql="select ID,'Western branch' Branch,{'2021-03-15'&quot;Date&quot;,35 Suma
    union
    select 2,'Eastern branch',{'2020-12-11'},37"
  />
  <button caption="Row unselect" onclick="zenPage.rowUnselect()"/>
</page>
}

ClientMethod rowUnselect() [ Language = javascript ]
{
  var tp=zen('tp');
  row=tp.selectedIndex;

  if (tp.rowSelect && row>=0) {
    var old=tp.enableToggleSelect;

    tp.enableToggleSelect=true;
    tp.selectRow(row);
    tp.enableToggleSelect=old;
  }
}

}

I also will insert my five kopecks.

  • The %Library package also includes stream classes, but those are deprecated. The class library includes additional stream classes, but those are not intended for general use.
    Working with Streams
    I have %Stream.FileCharacter was an order of magnitude faster than %[Library.]File
  • If you rewrite the line-by-line reading to read blocks with further parsing of lines, the speed will more increase by an order of magnitude.
     
    Sample
  • On the Internet, you can find a lot of materials about comparing the speed of reading files (in particular CSV) for different programming languages (Python, C/C++, R, C#, Java, etc.), for example (this is machine translation). Often, those who make such comparisons do not always know all these languages equally well, so sometimes casus happen.
     
    Who do you think in the article above was faster when reading 1e7+ lines: Fortran or C++ ?
  • If we approach the issue formally, then the advantage will be given to compiled languages, not interpreted ones, as well as the implementation that uses all the capabilities of the operating system and hardware.

How do you count "Count"?
Why is "Northwest" 1 instead of 2 for 2021?


For now so:

select v.Branchnvl(sum(%FOREACH(v.Branch)),0) "Count" from 
  (
  select 'Northwest' Branch,$listbuild('Northern','Western'Branches union
  select 'Oriental',$listbuild('Eastern'union
  select 'Southern',$listbuild('Southern')
  ) v
left join
  (select replace(%exact(Branch),' branch',''Branch,count(%FOREACH(Branch)) from yourtable where year("Date")=2021 group by Branchm
on m.Branch %inlist v.Branches
group by v.Branch

You are implicitly using %Library.SqlQuery:Func() method, in which, as @Robert Cemper rightly pointed out, $get() is used.

You can do it differently:

Query GetInfo(pObject AS Kurro.MyClassAs %SQLQuery(CONTAINID 1ROWSPEC "IdList:%String,IdProcess:%String,Duration:%String") [ SqlProc ]
{
    SELECT IdListIdProcessDuration
    FROM Kurro.MyClass
    WHERE KeyProcess :pObject.KeyProcess
    AND CodeSpecialist :pObject.CodeSpecialist
    AND CodeProvider :pObject.CodeProvider
    AND CodeCenter :pObject.CodeCenter
    AND "Date" :pObject.Date
}


set obj=##class(Kurro.MyClass).%New()
set obj.KeyProcess="1033004-1#"
set obj.CodeSpecialist "surgery"
set obj.CodeProvider "PR002"
set obj.CodeCenter "CENTER-01"
set obj.Date $ZDATETIME($ZDATETIMEH("2021-04-30 15:45:00",3,1),3,1)

set st=##class(%SQL.Statement).%New()
set sc=st.%PrepareClassQuery("Kurro.MyClass","GetInfo")
  if $$$ISERR(sc{write "%PrepareClassQuery failed:" do $System.Status.DisplayError(scquit}
set result=st.%Execute(obj)
do result.%Display()

I don't quite understand what you want to get.

If in the forehead, then so:

Select v.valueIdm.name 
 From (Select valueId Union Select Union Select Union Select Union Select 5) v
     left Join otherTable m
        on m.id v.valueId

But you can achieve the same thing more easily through IN or %INLIST.