Ok. Is their a way to the values of these objects? My initial question is how to read multiple records into local storage? For example the screenshots above show my collection column. I need to read each eecord to a local array. Isnt that possible?
Ok. Is their a way to the values of these objects? My initial question is how to read multiple records into local storage? For example the screenshots above show my collection column. I need to read each eecord to a local array. Isnt that possible?
Hawk,
You turned out? "bonus" will be an array of all the values of MPD_Month.
Hi Evgene,
I'm still getting the error: Mapping expression is incorrect. Note that the model and storage names have been updated to (Member_Points_Details_Array) as in the second post in this thread. Is the mapping correct?
In order to reporoduce the problem:
link: http://appery.io/app/mobile-frame?src...
credentials: 1234/star1234
Navigation: NavBar My Points On page load the service (Member_Points_Details_Array) will be invoked (Screenshot of the service mapping shown in the second post in this thread) click on the button highlighted below and a panel will appear
When you click on any month, the number that should be passed to i will appear in alert. (e.g. when you click on June 2014, alert will show 6).
The code that should brings data from Member_Points_Details_Array is called on mobileradiogroup value change.
Apart from the long code only the main point need to be resolve. That is in this code when I select June 2014 and hence i = 6, the the following code:
prevar bonus = Apperyio.storage.MS_Member_Points_Details_Array.get("$['MPD_Month']");
console.log(bonus);/pre
should show the value of bonus of that month in consolde. Similarly, if I click on Jan 2014, the value of bonus of January should appear in the console.
In short, I expect the mapping to pass the values of the all column for that specific users and for all months into Member_Points_Details_Array
Many thanks for your help
Hi Hawk,
.get() function - returns object. Then you should navigate through this object with JS syntax.
Here is correct code for you:
pre
var bonus = Apperyio.storage.MS_Member_Points_Details_Array.get().MPD_Month;
/pre
Regards.
Hi Yurri,
I used this code and when I choose (Aug 2014) which mean i = 8, I got the error:
preUncaught TypeError: Cannot read property '8' of undefined /pre
Hi Hawk,
That means you have not object inside your "MS_Member_Points_Details_Array" storage with index "8" - only that.
Here is code with protection:
pre
var goalArray = Apperyio.storage.MS_Member_Points_Details_Array.get();
var bonus = "No object";
if(goalArray && goalArray && goalArray.MPD_Month)
bonus = goalArray.MPD_Month;
/pre
Regards.
Thanks Yurii, this works
Hi,
How can I set value a variable that is part of the storage model. I tried to refer to this tutorial (http://devcenter.appery.io/documentat...) but it did not help.
Basically, I have the storage model "MS_Outlet_Details" that has the variable "UserName". I can read the value of this variable using:
prevar UserName = Apperyio.storage.MS_Outlet_Details.get("$['UserName']");/pre
However, the following did not help to update the value of this variable:
preApperyio.storage.MS_Outlet_Details.set("$['UserName']",UserName); /pre
How can I update it?
Many thank,
Hawk,
Please take a look here http://devcenter.appery.io/documentat...
set(value) method.