Show globals in Excel
In MX any global can be displayed on a sheet in the form of a table.
We will look at the simplest example (work only with CACHE-2014+ or IRIS)
Upgrade or install MX.
Start mx.xlsb and connect to your namespase with vmx-routines.
After opening first sheet, click button [] ##class(SYS.Stats.Dashboard).Sample()
Then press button [design-mode] (top of screen ).
You will see something like this in the top four lines:
M-Formulas works in cells in the process of opening this sheet, step by step :
- - go to the namespace %SYS ( zn “%SYS” )
- - set dashboard=##class(SYS.Stats.Dashboard).Sample()
- - come back ( zn %UCI )
Next cell:
- - open the spooler (open 2:($j:1) use 2 ), zw dashboard , come back to principal device ( use 0 )
- - set the read index to the begin of the spooler ( set z="^SPOOL($j,0)" )
Next cell: ( located in the area of table construction)
- - read the lines, but print only those in which there is a ‘=’ sign
- ?_%mxIndex ; for row=1:1:999 set z=$$getObj(z,1),%mxIndex=z q:'$l(z) set rr=@z q:rr[" = "
- - if ‘OK’ or ‘Normal’ then set font green ( set formating tag ‘<mx fc10 ‘ )
- ?_q oo ; if q["OK"!(q["orma") set oo=oo_"<mx fc10 "
Spooler reading stops if %mxIndex=’’
As a result, global mapped to excel :
You can change formulas and observe the effect. If change, then click design-mode for save your version.
Any questions sia.enters@inbox.lv or here.
Best wishes
Alex