I have a REST API call that returns data similar to the set of data shown below. I need to get the “code” attribute value from each of the records retrieved in the “data” array and put those values into a separate array.
What I’m looking for is whether anyone knows of a way using standard ADF components/functions that will allow me to get the “code” attribute value from each record into an array in a more efficient manner than the ForEach activity?
Sample API Result:
{
“pageNumber”: 1,
“pageSize”: 100,
“resultCount”: 2,
“totalPages”: 1,
“previousPage”: null,
“nextPage”: null,
“totalRecords”: 2,
“data”: [
{
“internalId”: 5,
“id”: “4573f737-1811-4bba-a934-6b4b9597f6fe”,
“code”: “100004”,
“name”: “Property #1”,
“enterDTM”: “2023-08-11T14:55:01.28Z”,
“enterUserName”: “bryan.tubbs”,
“lastChgDTM”: “2023-08-11T15:02:11.843Z”,
“lastChgUserName”: “bryan.tubbs”,
“validationStatusID”: 1,
“canUpdate”: true,
“canDelete”: true
},
{
“internalId”: 6,
“id”: “2eeb1c64-1a5e-4e25-afb2-44095310fd4a”,
“code”: “100005”,
“name”: “Property #2”,
“enterDTM”: “2023-08-11T14:55:01.28Z”,
“enterUserName”: “bryan.tubbs”,
“lastChgDTM”: “2023-08-11T15:02:11.843Z”,
“lastChgUserName”: “bryan.tubbs”,
“validationStatusID”: 1,
“canUpdate”: true,
“canDelete”: true
}
],
“errors”: null,
}
I realize that I can use the ForEach activity and loop through the records in the data array. I’m currently using a ForEach loop, but 100 records can take up to 19 seconds to loop through the items and add the “code” attribute value to an array (not that efficient, especially when processing thousands of records).
Bryan Tubbs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.