Thank you Henrique,

But i need to write Excel files with a client server architecture, this is not a web application. I thought in a Class or something like this.

Hi Robert,

Do you know some article who teach how to create the Web Service to make a call? The Caché PHP module, didn't work for me, because works only locally.

Regards, 
Flávio.

With the bellow code, you will can count all nodes.

USER>S COUNTRY="",COUNT=0,NIV=""
USER>F  S COUNTRY=$O(^Locations(COUNTRY)) Q:COUNTRY=""  F  S NIV=$O(^Locations(COUNTRY,NIV)) Q:NIV=""  S COUNT=COUNT+1
USER>W COUNT
5
 

Count only USA

USER>S COUNTRY="USA",COUNT=0,NIV=""
USER>F  S NIV=$O(^Locations(COUNTRY,NIV)) Q:NIV=""  S COUNT=COUNT+1
USER>W COUNT
3
 

Count only Canada

USER>S COUNTRY="Canada",COUNT=0,NIV=""
USER>F  S NIV=$O(^Locations(COUNTRY,NIV)) Q:NIV=""  S COUNT=COUNT+1
USER>W COUNT
2
 

If you want to execute a Method in the Terminal, you need to use the DO command  with the Method, program and parameters.

Ex. 

DO METHOD^PROGRAM --> Call one Method Without Parameters

DO METHOD^PROGRAM(PAR1,PAR2) --> Call one method with two paramaters.

DO METHOD^PROGRAM(PAR1,PAR2),METHOD^PROGRAM --> Call two Methods in the same command.
 

Hello Robert,

I faced the same problem other day.
That was the query: "SELECT PROE,DESP,ID FROM ZVBMAPEAMENTO.SVINFOUVND WHERE JOB=1224 GROUP BY PROE"

Att. Flávio.

Hello Brendan,

I faced the same problem other day.
That was the query: "SELECT PROE,DESP,ID FROM ZVBMAPEAMENTO.SVINFOUVND WHERE JOB=1224 GROUP BY PROE". All is %String.

Att. Flávio.

I think this can solve your problem

SET DATE="20201121090000"

WRITE $ZD($ZDH($E(DATE,1,8),8),3) // DAY
WRITE $E(DATE,9,10)_":"_$E(DATE,11,12)_":"_$E(DATE,13,14) // HOUR

When I had problems with Cors I use overload of methods in my SuperClass to solve this problem.

ClassMethod HandleDefaultCorsRequest(pUrl As %String) As %Status [ Private ]
{
    Do %response.SetHeader("Access-Control-Allow-Origin","*")
    Do %response.SetHeader("Access-Control-Allow-Credentials","true")
    Do %response.SetHeader("Access-Control-Allow-Methods","GET, PUT, POST, DELETE, PATCH, OPTIONS")
    Do %response.SetHeader("Access-Control-Allow-Headers","Access-Control-*, Content-Type, Authorization, Accept, Accept-Language, X-Requested-With, Origin")
    
    Quit $$$OK
}