@@ -16,6 +16,7 @@ Class cRestChildCollection is a cObject
16
16
Property String psNodeName
17
17
18
18
Property Boolean pbReadOnly True
19
+ Property Integer piLimitResult 0
19
20
20
21
End_Procedure
21
22
@@ -34,20 +35,21 @@ Class cRestChildCollection is a cObject
34
35
*/
35
36
Procedure AppendToBody Handle hoResponseBody Handle hoIterator
36
37
Handle hoNestedArray hoNestedObject hoChild hoServer
37
- Integer iChildCount iIndex
38
+ Integer iChildCount iIndex iLimit iRecordsRetrieved
38
39
String sNodeName
39
40
40
41
Get Server to hoServer
41
42
Get SchemaName to sNodeName
42
43
Get Child_Count to iChildCount
44
+ Get piLimitResult to iLimit
43
45
44
46
//Create nested object
45
47
Get CreateResponseBodyArray of hoIterator sNodeName to hoNestedArray
46
48
47
49
//Start finding the child records
48
50
Send Find of hoServer FIRST_RECORD 1
49
51
50
- While (Found)
52
+ While ( ( Found) and not(Err) and ((iLimit = 0) or (iLimit > 0 and iRecordsRetrieved < iLimit)) )
51
53
//When we find a record create a new nested object
52
54
Get CreateResponseBodyObject of hoIterator sNodeName to hoNestedObject
53
55
@@ -60,6 +62,7 @@ Class cRestChildCollection is a cObject
60
62
//Add the nested object to the nested array
61
63
Send AppendToResponseArray of hoIterator hoNestedObject hoNestedArray
62
64
65
+ Increment iRecordsRetrieved
63
66
//Keep finding child records
64
67
Send Find of hoServer NEXT_RECORD 1
65
68
Loop
0 commit comments