@@ -16,6 +16,7 @@ Class cRestChildCollection is a cObject
1616 Property String psNodeName
1717
1818 Property Boolean pbReadOnly True
19+ Property Integer piLimitResult 0
1920
2021 End_Procedure
2122
@@ -34,20 +35,21 @@ Class cRestChildCollection is a cObject
3435 */
3536 Procedure AppendToBody Handle hoResponseBody Handle hoIterator
3637 Handle hoNestedArray hoNestedObject hoChild hoServer
37- Integer iChildCount iIndex
38+ Integer iChildCount iIndex iLimit iRecordsRetrieved
3839 String sNodeName
3940
4041 Get Server to hoServer
4142 Get SchemaName to sNodeName
4243 Get Child_Count to iChildCount
44+ Get piLimitResult to iLimit
4345
4446 //Create nested object
4547 Get CreateResponseBodyArray of hoIterator sNodeName to hoNestedArray
4648
4749 //Start finding the child records
4850 Send Find of hoServer FIRST_RECORD 1
4951
50- While (Found)
52+ While ( ( Found) and not(Err) and ((iLimit = 0) or (iLimit > 0 and iRecordsRetrieved < iLimit)) )
5153 //When we find a record create a new nested object
5254 Get CreateResponseBodyObject of hoIterator sNodeName to hoNestedObject
5355
@@ -60,6 +62,7 @@ Class cRestChildCollection is a cObject
6062 //Add the nested object to the nested array
6163 Send AppendToResponseArray of hoIterator hoNestedObject hoNestedArray
6264
65+ Increment iRecordsRetrieved
6366 //Keep finding child records
6467 Send Find of hoServer NEXT_RECORD 1
6568 Loop
0 commit comments