Return An Array Of Resultsets From The Server In Worklight
I want to use the values from multiple rows returned in a resultSet to invoke a procedure again and again and display the result of the invoked procedure on main html page Adapter
Solution 1:
What you need to do is to mashup both result sets from the getRegNo with the getFinal. Here is how to get an array of resultSets from the server
Change your code from:
//here c.resultSet contains two rows var d={},e;
if(cc && cc.length>0) {
for(var i=0;i<c.resultSet.length;i++) {
d[i]=getFinal(cc[i].RegNo,MedId[0].MedId);
}
return d;
}
in your code you will get something like {0 : 'regNo_1', 1 : 'regNo_2'}
where the integer is d[i]
to:
//here c.resultSet contains two rowsif (cc && cc.length > 0) {
for (var i = 0; i < cc.length; i++) {
cc[i].regNo = getFinal(cc[i].RegNo,MedId[0].MedId);
}
return {'regNos' : cc};
}
}
In order to get an array of resultSets that will look like this:
{"regNos":[{"regNo":12345,"regNo":{"isSuccessful":true,"regNo":[{"regNo":"1"}]}},{"regNo":54321,"regNo":{"isSuccessful":true,"resultSet":[{"regNo":"2"}]}}],"isSuccessful":true}
Post a Comment for "Return An Array Of Resultsets From The Server In Worklight"