Page 3 of 3

Reading multiple DB records into storage model

Posted: Fri Dec 19, 2014 2:39 pm
by Hawk

Hi Alena,
I already had a look at it. It is the same link I posted above. The problem is in the documentioan the example is about set value to storage variable only. There is no example on how to set value to storage variable as a part of storage model. My storage model has a variable "UserName". Hkw can set value to this variable?


Reading multiple DB records into storage model

Posted: Sat Dec 20, 2014 8:18 am
by Hawk

My model is as follows:

Image

And this is the storage:
Image

So how can I refer to "UserName" ? . In the tutorial there is something like this:

preApperyio.storage.MS_Outlet_Details.set("Sam Dean")/pre

This does not work for me, as MS_Outlet_Details is an object of the type "Outlet_Details". Besides, I tried the following;

preApperyio.storage.MS_Outlet_Details.UserName.set(UserName); /pre

I return the error "cannot use "set" with undefined".

So, I need to set value to the property "UserName" in the object "MS_Outlet_Details".

Thanks


Reading multiple DB records into storage model

Posted: Sun Dec 21, 2014 11:20 pm
by Yurii Orishchuk

Hi Hawk,

Here is a code to set property inside the storage object.

pre

//Get object
var storageObject = Apperyio.storage.MS_Outlet_Details.get();

//Set object property
storageObject.UserName = UserName;

//Store storage object
Apperyio.storage.MS_Outlet_Details.set(storageObject);

/pre

Regards.


Reading multiple DB records into storage model

Posted: Thu Aug 13, 2015 5:01 pm
by Blair Cox

Doesn't work for me - having the same issue where I want to pull back an array in local storage in order to walk through the list and pass values to Google Map in order to drop markers (per the tutorial). But it returns only [Object] rather than values/names. The code you provide here seems incomplete. Specifically, how to properly set the object property.

Thanks!