sdanigo
Posts: 0
Joined: Sat Jun 06, 2015 8:50 pm

Accesing the return dataset of a query

Hi,
I'm still a newbie here :-)
When we perform a query on a database, what is the correct syntax in JS to access the returned data.
Example, I query some customer from a mySql database, it is supposed to return the custId and the custName. I would like to
-1- store the whole return dataset in a local storage variable so I can use it later, even if offline.
-2- perform some task on the returned fields (add some extra information depending of the value of the content for example)

If someone could help me, it would be greatly appreciated.

Thanks

Sylvain

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Accesing the return dataset of a query

Hello,

Could you clarify what have you tried and what exactly does not work? You can save whole service's response on its success event.

sdanigo
Posts: 0
Joined: Sat Jun 06, 2015 8:50 pm

Accesing the return dataset of a query

Hi
I use a rest service. It is returning 3 fields:
custId,custFirstname and custLastName.
I know how to map them to screen components.. My question are:
What is the correct JS syntax to save the whole response on a localstorage variable in the succes event of the service ?
What is the correct JS syntax to access for example each custFirstname and custLastname in order for example to create a computed field on each record.

Thanks

Sylvain

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Accesing the return dataset of a query

You can get whole response on success event in data variable.
So you can get each element with loop:

for(var i = 0; i < data.length; i++){
console.log(data.custFirstname);
}

sdanigo
Posts: 0
Joined: Sat Jun 06, 2015 8:50 pm

Accesing the return dataset of a query

Thank you

Return to “Issues”