I’m trying to use the datastore to manage user UI preferences.
After the user is logged in, i load pref’s from the database with a SC and store it in datastore.
The datastore structure is very simple like this:
It’s works perfectly, BUT, i do not figure out how to retreive a user pref value from the datastrore with a key (which is “code”).
For example, i want to hide a Label if the user pref code BOOKS_EMP is equal to 1. I treid to put this in the dynamic attribute of the label:
After pref’s are loaded in the datastore, i have an array like this:
{$id: 1, code: “BOOKS_DF”, value: “2020-01-31”}
{$id: 2, code: “BOOKS_DD”, value: “2020-01-01”}
{$id: 3, code: “BOOKS_EMP”, value: “1”}
{$id: 4, code: “BOOKS_VIEW”, value: “2”}
I need to retreive the value of the key BOOKS_EMP to know if i must hide or not the label (just an example). 1=hide 0=show or whatever…
Your remark is very judicious. At this stage of my development, I don’t actually know the number of options, but it will inevitably stabilise. However, my application is going to be important and the number of options very important. In addition, I am in a context with a single database for several customers and several users per customer.
For the moment, my SC filters the preferences for each page, but perhaps performance issues will cause me to reconsider my choice.
In any case, I would like to reiterate my thanks for your (and also for your team’s) responsiveness. That’s also why I love wappler !