Installation:
- Unzip MX to any folder /path/to/mymx, then :
- $ docker run --name myiris -p 52773:52773 -v /path/to/mymx:/mx -d store/intersystems/iris-community:2020.1.0.202.0
- $ docker exec -it myiris iris session iris
- USER> do $System.OBJ.ImportDir(“/mx”,”vmx.ro”,”ck”,,1)
- USER> do $System.OBJ.ImportDir("/mx","reports.cls","ck",,1)
Call example:
- USER> set p="^oPeat | Country Country:Date | tn cost | d8 Province Product | | if Date'<20200101,Date'>20200222 | set cost=summa,d8=$$gmd^MXD(Date)"
- USER> set p1="Country | tn | cost | d8 " ; line to print for report 1
- USER> set p2="Country | Date | tn | cost " ; line to print for report 2
- USER> set x=##class(Reports.Term).Tree(p,p1,p2)
The parameter ‘p’ consists of the following |fields|:
- global name -- ^oPeat
- reports structure -- Country Country:Date
- a list of variable names to summarize in reports -- tn cost
- a list of names for easy movement from global to reports -- d8 Province Product
- reserved field
- field for the condition (filter)-- if Date'<20200101,Date'>20200222
- field for additional commands -- set cost=summa,d8=$$gmd^MXD(Date)
Reporting globals ^om, ^oTQMo will be generated for future reference.
Demo:
USER> set x=##class(Reports.Term).TreeDemo()
Result:
- __Country_____tn___________cost_______d8
- _France______390___________5160.00___2020.02.16꘎2020.02.17꘎2020.02.18
- _Germany_____659.752_______6598.02___2020.01.02꘎2020.01.06꘎2020.02.05
- _Italy_______435.754_______5621.76___2020.01.02꘎2020.01.05
- _꘎TOTAL꘎_____1485.506_____17379.78
- _Country_____Date________tn__________cost
-
_France______2020.02.16__130___________1980.00
-
_France______2020.02.17__130___________1980.00
-
_France______2020.02.18__130___________1200.00
-
France_____꘎TOTAL꘎_____390___________5160.00
-
_Germany_____2020.01.02__329.752_______3332.02
-
_Germany_____2020.01.06__260___________2866.00
-
_Germany_____2020.02.05__70_____________400.00
-
Germany____꘎TOTAL꘎_____659.752_______6598.02
-
_Italy_______2020.01.02__235.754_______3321.76
-
_Italy_______2020.01.05__200___________2300.00
-
Italy______꘎TOTAL꘎_____435.754_______5621.76
-
_꘎TOTAL꘎_____꘎TOTAL꘎_____1485.506_____17379.78
USER>
Limitations for the global.
- The length of all branches is the same.
- The last level index names are in accordance with the MUMPS standard for simple variables.
- The % sign is not used in last level index names.
Global example:
-
^oPeat(1,"Date")=20200102
-
^oPeat(1,"Product")="frezkudra"
-
^oPeat(1,"Province")=22
-
^oPeat(1,"n")=1
-
^oPeat(1,"summa")=700
-
^oPeat(1,"tn")=67.877
-
^oPeat(2,"Country")="Italy"
-
^oPeat(2,"Date")=20200102
-
^oPeat(2,"Product")="gabalkudra"
-
^oPeat(2,"Province")=22
-
^oPeat(2,"n")=2