This is my stored procedure:
CREATE PROCEDURE PROC()
BEGIN
SELECT * FROM TABLENAME;
END//
This is my unction to call stored procedure using SQL adapter:
function callStored() {
return WL.Server.invokeSQLStoredProcedure({
procedure : "proc",
parameters : []
});
}
This is the invocationResult:
{
"isSuccessful": true,
"resultSet": [
{
"name": "a",
"pass": "123",
"time_stamp": "2014-04-07T10:13:17.000Z"
},
{
"name": "chetan",
"pass": "123456",
"time_stamp": "2014-04-07T10:13:34.000Z"
},
{
"name": "dileep",
"pass": "456321",
"time_stamp": "2014-04-07T10:13:54.000Z"
},
{
"name": "bnc",
"pass": "654321",
"time_stamp": "2014-04-07T10:19:37.000Z"
}
]
}
I need to parse this and display or alert the values of name
, pass
and time_stamp
.
How do I accomplish this?
Please read the "Invoking adapter procedures from client applications" and its Exercise and code sample in the Getting started with IBM Worklight page.
In your application JavaScript (common\js\main.js), you can have something like the following. In the below code an alert will be displayed with the values of the
name
key from the resultSet.You can also take a look here: use resultset returned by WL.Server.invokeSQLStatement within sql adapter procedure
You have already asked this here: ibm worklight stored procedure
Why did you not follow through the documentation and learned how to write the above?
Please read the documentation!