-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjIteration.cls
More file actions
30 lines (28 loc) · 829 Bytes
/
ObjIteration.cls
File metadata and controls
30 lines (28 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Class User.ObjIteration
{
/// Builds the search query dynamically based on a dynamic object passed in that holds the parameters
ClassMethod BuildSearch(ByRef pSet As %DynamicObject) As %Status
{
set pSet = {}
set pSet.username = "somebody"
set pSet.children = {}
set pSet.children.a = "child 1"
set pSet.children.b = "child 2"
set pSet.thing = "stuff"
set obj = pSet.%GetIterator()
while obj.%GetNext(.key, .val) {
try {
set objs = val.%GetIterator()
set tQuery = tQuery_" and "_key_" in ("
while objs.%GetNext(.keys, .vals) {
set tQuery = tQuery_"'"_vals_"',"
}
set tQuery = $zstrip(tQuery,">",",")_")"
continue
}
catch(e) {}
set tQuery = tQuery_" and "_key_" = '"_val_"'"
}
// Run query...
}
}