Subversion Repositories DevTools

Rev

Rev 6953 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6953 Rev 6970
Line 188... Line 188...
188
    '   Set someVar  = oJSON.Collection()       (Will create an empty collection)
188
    '   Set someVar  = oJSON.Collection()       (Will create an empty collection)
189
    '   obj(field) = data                       (Will create a hash entry)
189
    '   obj(field) = data                       (Will create a hash entry)
190
    '   newObj = oJSON.AddToCollection( obj )   (Will create an array)
190
    '   newObj = oJSON.AddToCollection( obj )   (Will create an array)
191
 
191
 
192
    Dim lastPvid : lastPvid = 0
192
    Dim lastPvid : lastPvid = 0
193
    Dim extraData
193
    Dim pvid, lastItem
194
    Dim extraIdx
194
    Dim childCount, pType
195
    Dim pvid
-
 
196
    Set oJSON.data("aaData") = oJSON.Collection()
195
    Set oJSON.data("aaData") = oJSON.Collection()
-
 
196
    lastItem = null
197
 
197
 
198
    While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
198
    While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
199
        pvid = rsQry("PV_ID") 
199
        pvid = rsQry("PV_ID") 
-
 
200
 
200
        If pvid <> lastPvid Then
201
        If lastPvid <> pvid Then
201
            ' This is a new entry
202
            childCount = 0
202
            lastPvid = pvid
203
            pType = 0
-
 
204
        Else 
-
 
205
            childCount = childCount + 1
-
 
206
            pType = 2
-
 
207
        End If
-
 
208
 
203
            Set newitem = oJSON.AddToCollection(oJSON.data("aaData"))
209
        Set newitem = oJSON.AddToCollection(oJSON.data("aaData"))
204
            newitem(0)= rsQry("PV_ID") 
210
        newitem(0)= rsQry("PV_ID") 
205
            newitem(1)= rsQry("VIEW_NAME")
211
        newitem(1)= rsQry("VIEW_NAME")
206
            newitem(2)= rsQry("PKG_ID")
212
        newitem(2)= rsQry("PKG_ID")
207
            newitem(3)= rsQry("PKG_NAME")
213
        newitem(3)= rsQry("PKG_NAME")
208
            newitem(4)= rsQry("PKG_VERSION") 
214
        newitem(4)= rsQry("PKG_VERSION") 
209
            newitem(5)= rsQry("V_EXT")
215
        newitem(5)= rsQry("V_EXT")
210
            newitem(6)= rsQry("CREATED_STAMP") 
216
        newitem(6)= rsQry("CREATED_STAMP") 
211
            newitem(7)= rsQry("NEW_PV_ID")
217
        newitem(7)= rsQry("NEW_PV_ID")
212
            newitem(8)= rsQry("NEW_PKG_VERSION")
218
        newitem(8)= rsQry("NEW_PKG_VERSION")
213
            newitem(9)= rsQry("NEW_CREATED_STAMP")
219
        newitem(9)= rsQry("NEW_CREATED_STAMP")
214
            extraIdx = 0
220
        newitem(10)= pType
215
 
-
 
216
        Else
-
 
217
            ' Additional Data to be added
-
 
218
            '   May need to add an array, before adding entries to the array
-
 
219
            If extraIdx = 0 Then
221
        newitem(11)= rsQry("NEW_AGE")
220
                Set extraData = oJSON.Collection()
-
 
221
                newitem.Add 10 ,extraData
222
        newitem(12)= rsQry("ETYPE")
222
            End If
-
 
223
 
223
 
224
            Dim entry: Set entry = oJSON.Collection()
224
        ' Is the last item a parent (Has children)
225
            entry(0)= rsQry("NEW_PV_ID")
225
        '   entry(10)
226
            entry(1)= rsQry("NEW_PKG_VERSION")
226
        '       0 - Is a parent without children
227
            entry(2)= rsQry("NEW_CREATED_STAMP")
227
        '       1 - Is a parent with children
228
            extraData.Add extraIdx, entry
228
        '       2 - Is a child
-
 
229
        '
-
 
230
        If childCount = 1 AND NOT isNULL(lastItem)  Then
229
            extraIdx = extraIdx + 1
231
            lastItem(10)= 1
230
        End If
232
        End If
231
 
233
 
-
 
234
        ' If this is an entry of ETYPE of A, then we skip the next entry.
-
 
235
        ' It will be repeat
-
 
236
        If rsQry("ETYPE") = "A" Then
-
 
237
            rsQry.MoveNext
-
 
238
        End If
-
 
239
 
-
 
240
 
-
 
241
       lastPvid = pvid
-
 
242
       Set lastItem = newitem
232
       rsQry.MoveNext
243
       rsQry.MoveNext
233
    Wend
244
    Wend
234
 
245
 
235
End Sub
246
End Sub
236
 
247