As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Log.i("PROGRESS", "Success while fetching progress result and results length :- "+results);
//List progressList = Arrays.asList(results);
//Log.i("PROGRESS", "iS THERE ANY ITEM IN LIST"+progressList);
}
@Override
public void onFailure(Throwable error) {
Log.e("PROGRESS", "failed to fetchByFilterCriteria", error);
}
});
}
I don't understand if i am able to see response in collection hook and and sending it to client then why i am getting null.
Please give me any reference or hint
M
Michael
said
over 9 years ago
If you want to send it back to the client, then yes, you need to set response.body and response.complete in the callback itself.
s
sandip_armal
said
over 9 years ago
I got your point of moving logger statement into find function itself, but actually I was asking about whether I need to set data to response.body in find itself ? so that I can receive it ?
I tried with awaitdata but still its not seems to be working.... and do I need to set it to response in find itself ?
M
Michael
said
over 9 years ago
testCollection.find() is an asynchronous call to the database. In your example, the find method is executed asynchronously, and then the logger methods are immediately executed before the find callback is invoked. If you move the logger statements at the end of this code to within the callback (after the for loop) it should resolve this issue.
sandip_armal
I am using below code to find records from some collection.
var tests = {};
testCollection.find({testid: testNumber}, { sort:{timestamp: 1 },
function( err, results) {
if(err) {
logger.error("Unable to proceed");
}
for(var i = 0; i
tests[i] = results[i].name;
}
});
logger.info("Available Tests");
logger.info(tests);
So I am always getting tests printed as {};
Why the properties are not being set to tests in for loop ?