Page 1 of 1

How can I access an array inside of other array in local Storage?

Posted: Tue Jun 02, 2015 3:12 pm
by Leonardo Valentin Zeferino

I'm trying to run the bellow code but it's occouring an error in "data.company_id.id":
User transformation function exception. Reason: Cannot read property 'id' of null

code
var dataString = localStorage.getItem("selectedItem");
var data = JSON.parse(dataString);

return '{"$and": [{"user_id.id":"' + Apperyio.storage.id_token.get() + '"},{"company_id.id":"' + data.company_id._id + '"}]}';
/code


How can I access an array inside of other array in local Storage?

Posted: Tue Jun 02, 2015 7:06 pm
by Serhii Kulibaba

Hello Leonardo,

Please use storage feature instead of simple localStorage.
There is an example of usage arrays in storage: https://devcenter.appery.io/documenta...


How can I access an array inside of other array in local Storage?

Posted: Tue Jun 02, 2015 8:17 pm
by Leonardo Valentin Zeferino

Thanks, Sergiy!
It works!


How can I access an array inside of other array in local Storage?

Posted: Thu Feb 02, 2017 3:24 am
by Deon

Your link is broken. Please update link.


How can I access an array inside of other array in local Storage?

Posted: Thu Feb 02, 2017 12:42 pm
by Galyna Abramovych

Deon,

Here is an updated link: https://docs.appery.io/reference#jque...


How can I access an array inside of other array in local Storage?

Posted: Thu Feb 02, 2017 3:50 pm
by Deon

Thanks, how can I append to a storage variable to create an array though. This link just explains get and update of standard storage variables


How can I access an array inside of other array in local Storage?

Posted: Fri Feb 03, 2017 9:18 am
by Serhii Kulibaba

Hello,

Please create a Storage variable, based on the Model with a type "array" there