Try changing your adapter JavaScript implementation to the following instead.
I tried a version of this with different table and variables and it worked for me (at least, the adapter invocation from Worklight Studio).
Note how I am using locId.resultSet
and not locId.invocationResult.resultSet
. The latter is used on the client-side whereas the former is used on the server-side.
Also note the separation to two functions.
function getStudentInfos(Name,Location) {
var locId, a, b;
locId = getlocId(Location);
a = locId.resultSet;
if (a && a.length>0) {
b = a[0].LocId;
}
return WL.Server.invokeSQLStatement({
preparedStatement : selectStatement3,
parameters : [b]
});
}
function getlocId (Location) {
var result = WL.Server.invokeSQLStatement({
preparedStatement : selectStatement2,
parameters : [Location]
});
return result;
}
Note the if
statement... make sure to add some error handling there as well...