Skip to content

Commit 89d536a

Browse files
authored
Merge pull request #133 from Frisle/master
FIX: rollback to the state of 3.2.23 version
2 parents 546c31f + eb6c186 commit 89d536a

File tree

1 file changed

+46
-38
lines changed

1 file changed

+46
-38
lines changed

MDX2JSON/ResultSet.cls

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Method ToProxyObject(Output pStatus As %Status) As %ZEN.proxyObject
1919
return ""
2020
}
2121

22+
set tQueryKey = ..%QueryKey
23+
2224
/*set st = ..%GetQueryStatus(..%Cube,tQueryKey)
2325
if (st < 100) {
2426
hang 1
@@ -33,7 +35,7 @@ Method ToProxyObject(Output pStatus As %Status) As %ZEN.proxyObject
3335
try {
3436
set obj.Info = ..InfoToProxyObject() // basic info about cube and query
3537
quit:obj.Info.percentDone<100
36-
38+
3739
set obj.Cols = ..AxesToListOfObjects() // all axes
3840
set obj.Data = ..DataToListOfDataTypes() // array of all cells, left-to-right, up-to-down
3941
} catch ex {
@@ -77,7 +79,7 @@ Method InfoToProxyObject() As %ZEN.proxyObject
7779
set info.numericGroupSeparator = ##class(%SYS.NLS.Format).GetFormatItem("NumericGroupSeparator")
7880
set info.numericGroupSize = ##class(%SYS.NLS.Format).GetFormatItem("NumericGroupSize")
7981
set info.decimalSeparator = ##class(%SYS.NLS.Format).GetFormatItem("DecimalSeparator")
80-
82+
8183
return info
8284
}
8385

@@ -93,10 +95,11 @@ Method AxesToListOfObjects() As %ListOfObjects
9395
}
9496

9597
set axes=$$$NewDynObjList
98+
9699
for a = 1:1:tAxisCount {
97100
set tAxisSize(a) = ..%GetAxisSize(a)
98101
set tAxisKeys(a) = $G($$$DeepSeeResultsGLVN(tCubeIndex,tQueryKey,"axis",a))
99-
$$$Insert(axes,..ProcessOneAxis(tCubeIndex,tAxisKeys(a),a,tAxisSize(a)))
102+
$$$Insert(axes,..ProcessOneAxis(tCubeIndex,tAxisKeys(a),a))
100103
}
101104

102105
if ($$$ListSize(axes)=0) {
@@ -106,71 +109,68 @@ Method AxesToListOfObjects() As %ListOfObjects
106109
return axes
107110
}
108111

109-
Method ProcessOneAxis(CubeIndex, AxisKey, AxisNumber, AxisSize) As %ZEN.proxyObject [ Internal ]
112+
Method ProcessOneAxis(CubeIndex, AxisKey, AxisNumber) As %ZEN.proxyObject [ Internal ]
110113
{
111114
set tCubeName = $$$UPPER(..%Cube)
112115
set tQueryKey = ..%QueryKey
113116

114-
set axis = ..LoopProcessingAxisCells(CubeIndex, AxisKey, tCubeName, tQueryKey, AxisNumber, 1,AxisSize)
117+
set axis=$$$NewDynObj
118+
set axis.tuples = ..ProcessOneAxisCell(CubeIndex, AxisKey, tCubeName, tQueryKey, AxisNumber, 1)
115119

116120
return axis
117121
}
118122

119-
Method LoopProcessingAxisCells(CubeIndex, AxisKey, CubeName, QueryKey, AxisNumber, Node, AxisSize) As %ZEN.proxyObject [ Internal ]
123+
Method ProcessOneAxisCell(CubeIndex, AxisKey, CubeName, QueryKey, AxisNumber, Node) As %ZEN.proxyObject [ Internal ]
120124
{
125+
set cell=$$$NewDynObj
121126

122-
set axis=$$$NewDynObj
127+
set tNode = $G($$$DeepSeeAxisGLVN(CubeIndex,AxisKey,"axes",Node))
128+
129+
set cell.caption = ##class(%DeepSee.UserPortal.Utils).%ResolveText($LG(tNode,5)) // text caption
130+
set cell.vis = $LG(tNode,2) // visibility helper - does not help (apperently it shows if the cell is the lowest level)
123131

132+
// now we process cell children, if any exist
124133
if ($D($$$DeepSeeAxisGLVN(CubeIndex, AxisKey, "axes", Node, "ch")) = 10) {
125-
set axis.tuples = $$$NewDynObjList
126-
for i=1:1:AxisSize
127-
{
128-
set key = $G(@..%ResultCacheLocation@(..%CubeKey,..%QueryKey,"leaf",AxisNumber,i))
134+
set cell.children = $$$NewDynObjList
135+
set key = $O($$$DeepSeeAxisGLVN(CubeIndex, AxisKey, "axes", Node, "ch", ""))
136+
while (key'="") {
129137
set children = ..ProcessOneAxisCell(CubeIndex, AxisKey, CubeName, QueryKey, AxisNumber, key)
130138
// Append children to cell
131139
if $isobject(children) {
132140
if ((children.%IsA("%ZEN.proxyObject")) || (children.%IsA("%Library.Object"))) {
133-
$$$Insert(axis.tuples,children)
141+
$$$Insert(cell.children,children)
134142
} elseif ((children.%IsA("%Collection.AbstractList")) || (children.%IsA("%Library.Array"))) {
135143
for i=1:1:$$$ListSize(children) {
136-
$$$Insert(axis.tuples,$$$ListGet(children,i))
144+
$$$Insert(cell.children,$$$ListGet(children,i))
137145
}
138146
}
139147
}
148+
149+
set key = $O($$$DeepSeeAxisGLVN(CubeIndex, AxisKey, "axes", Node, "ch", key))
140150
}
141151
}
142152

143-
return axis
144-
}
145-
146-
Method ProcessOneAxisCell(CubeIndex, AxisKey, CubeName, QueryKey, AxisNumber, Node) As %ZEN.proxyObject [ Internal ]
147-
{
148-
set cell=$$$NewDynObj
149-
set tNode = $G($$$DeepSeeAxisGLVN(CubeIndex,AxisKey,"axes",Node))
150-
set cell.caption = ##class(%DeepSee.UserPortal.Utils).%ResolveText($LG(tNode,5)) // text caption
151-
set cell.vis = $LG(tNode,2) // visibility helper - does not help (apperently it shows if the cell is the lowest level)
152-
153153
//To filter out invisible сells
154-
if (..IsCellNull(cell)=1) {
154+
if (..IsCellNull(cell, AxisNumber, Node)=1) {
155155
return cell.children
156156
}
157-
157+
158158
try {
159159
set cell.path = ##class(%DeepSee.Query.Engine).%GetSpecForAxisNode(CubeName, QueryKey, AxisNumber, Node) // MDX cell path
160160
set:$e(cell.path)="(" cell.path = $e(cell.path, 2, *-1) // removing redundant parentheses
161161
} catch ex {
162162
set cell.path = "path too long"
163163
}
164-
164+
165165
set cell.format = $LG(tNode,12) // format for numbers, eg: $## ###.##
166166
set cell.total = $LG(tNode,8) //COUNT,AVG function
167167
set cell.type = $LG(tNode,1) // mbr,cmbr,lit,exp
168168
set cell.valueID = $LG(tNode,6) // id in mdx dimension for mbr, path for cmbr
169169
set cell.title = $LG(tNode,23)
170-
170+
171171
set cell.headerStyle = $LG(tNode,19)
172172
set cell.cellStyle = $LG(tNode,18)
173-
173+
174174
set info = $LG(tNode,18)
175175
if info'="" { // extract aggregation information, leave the rest as css
176176
set summaryposition = $f(info,"summary")
@@ -181,7 +181,7 @@ Method ProcessOneAxisCell(CubeIndex, AxisKey, CubeName, QueryKey, AxisNumber, No
181181
}
182182
set cell.style = info // css
183183
}
184-
184+
185185
set tDimNo = $LG(tNode,9)
186186
set tHierNo = $LG(tNode,10)
187187
set tLevelNo = $LG(tNode,11)
@@ -190,30 +190,38 @@ Method ProcessOneAxisCell(CubeIndex, AxisKey, CubeName, QueryKey, AxisNumber, No
190190
do ##class(%DeepSee.Utils).%GetDimensionCaption(CubeName,tDimNo, tHierNo,tLevelNo, .tAxisCaption)
191191
set cell.dimension = tCaption // cube dimension taken from the name of the axes.
192192
if (cell.dimension = "") {set cell.dimension = tCaption} // hack for assigne dimension property in case of empty dimension
193-
193+
194194

195195
set:$$$Debug cell.visible = '..IsCellNull(cell,AxisNumber,Node)
196196
set:$$$Debug cell.node = Node
197197

198198
return cell
199199
}
200200

201-
/// Determine if cell is an invisible system cell.
202-
Method IsCellNull(Cell)
201+
/// Determine if cell is an invisyble system cell.
202+
Method IsCellNull(Cell, AxisNumber, Node)
203203
{
204-
204+
return:((Cell.type = "axis") || (Cell.type = "set")) 1 // for top-level cells
205+
205206
return:(Cell.caption=0) 1 // typical caption for top-level cell
206207
return:(Cell.caption=1) 1 // typical caption for top-level cell
207208
return:(Cell.caption="") 1 // typical caption for top-level cell
208209
//return:(caption'="") 0
209210
//return:(path="") 1
210211
set children = Cell.children
211212
return:(($isobject(children)) && ($$$ListSize(children)>0)) 0 // cell has children
212-
213-
// in case of cell type='lit'. the 'lit' cell always has the value vis=0, so we can skip it
214-
// this is also true for type='axis' and type='set' so there is no need to check everything individually
215-
return:(Cell.vis '= 0) 0
216-
213+
214+
if (Cell.type'="lit") {
215+
set key = $O($$$DeepSeeResultsGLVN(..%CubeKey, ..%QueryKey, "leaf", AxisNumber, ""))
216+
while (key'="") {
217+
return:(Node=$$$DeepSeeResultsGLVN(..%CubeKey, ..%QueryKey, "leaf", AxisNumber, key)) 0 //for leafs
218+
set key = $O($$$DeepSeeResultsGLVN(..%CubeKey, ..%QueryKey, "leaf", AxisNumber, key))
219+
}
220+
} else {
221+
/// lit cell: SELECT %LABEL("Const","Title") ON 0 FROM [HoleFoodsBudget]
222+
/// but also a lot of top-pevel cells
223+
return 'Cell.vis
224+
}
217225

218226
return 1
219227
}

0 commit comments

Comments
 (0)