I am trying to loop through an array to query my order class to find the associated identifier, and then loop another class with this id.
There are 4 elements in the original array, and they must match the identifier, each of which has 43 elements in the third query.
However, instead of getting 43 results from the 3rd request for an identifier, I get the results 12 * 43.
I canβt understand how my code is wrong, and I tried to be contained. Also without any results.
$scope.positionIds = []; $scope.dataDictionary = {}; $scope.quotes = function () { for (var i=0; i < $scope.positions.length; i++){ var positionNow = $scope.positions[i]; var orderQuery = new Parse.Query('Order'); orderQuery.equalTo('objectId', positionNow ); orderQuery.find({ success: function(result) { console.log(result); for (var j=0; j < result.length; j++){ $scope.positionIds.push(result[j].attributes.positionId); } for (var k=0; k < $scope.positionIds.length; k++){ var portfolioQuery = new Parse.Query('DayPosition'); portfolioQuery.limit(1000); var positionSecond = $scope.positionIds[k]; portfolioQuery.equalTo('positionId', positionSecond); console.log("positionId", $scope.positionIds[k]); portfolioQuery.find({ success: function(result) { console.log("count", result.length); for (var h=0; h < result.length; h++){
source share