Page 1 of 1

Parse array in located in Appery Model storage to retrieve values to show/ hide button on page

Posted: Fri Oct 23, 2015 4:14 am
by realmadrid2121 .

Currently I have a watchlist storing id's properly in an array in model storage (it can contain from 0 to many user id's) : for example this is how its is storing currently

user = {"watchlist":["56201e23e4b034ce89ef54dd","5623d164e4b074527e1e6003"]}

On a page I have 2 buttons called "Add to Watchlist" and "Remove from Watchlist" On page load I need a JS that will parse the watchlist array above. On a page I am passing in a user_id from a query service . The value Im passing in is called "provider_id" . If theres a match of this " provider_id" with a string from the array then the "Remove from Watchlist" button should show. If one of the strings in the array doesnt exist/match the provider_id ... then the "Add to Watchlist" button should show.
I can access the array with the following:
Apperyio.storage.user.get("$['watchlist']");

Thank You


Parse array in located in Appery Model storage to retrieve values to show/ hide button on page

Posted: Fri Oct 23, 2015 3:35 pm
by Serhii Kulibaba

Hello,

You can get storage array item by it's index. Please look here for more information: https://devcenter.appery.io/documenta...