I'm new to SAPUI5 and I'm having problems...
When I use a read
function to get a value from an OData service, I'm trying to use another read
function inside the success function, using a filter with the value that I obtained from the first read.
Is this even possible?
Up to now, it just seems like it reads successfully, but then it doesn't execute the next read.
var filters = new Array();
var first_Filter = new sap.ui.model.Filter({
path: "userId",
operator: sap.ui.model.FilterOperator.EQ,
value1: userId
});
filters.push(first_Filter);
this.getOwnerComponent().getModel().read("/users", {
filters: la_filters,
success: function(oData, response) {
var data = oData.results[0];
var jobid = data.jobId;
var filters2 = new Array();
var second_Filter2 = new sap.ui.model.Filter({
path: "idJob",
operator: sap.ui.model.FilterOperator.EQ,
value1: jobid
});
filters2.push(second_Filter2);
this.getOwnerComponent().getModel().read("/jobs", {
filters: la_filters2,
success: function(oData2) {
// read odata ,get value and pass it on...
}
});
}
});