PDA

View Full Version : How to set namespace for lists dynamically


ABC123

cptutrecht
07-31-2017, 05:27 PM
If lists are persisted to local storage one can add a prefix (name) to the namespace AA uses for that (see screenshot)

I need to set that prefix (name) dynamically, for example equal to an argument or a session variable. Because a user can use the same application (but with different databases) more than 1 time on the same device.

Any ideas?

43785

Davidk
08-02-2017, 12:50 PM
You could try something like this. "namespace" is a property of the {dialog.Object} property object "_localStorageSettings". Using <Default>, namespace is set to something like...


"ALPHA_ee39bcaee5dd4c0cadfa7060c196fda0"

So, when your app starts, and before you do anything with storage, you could try changing the namespace value.


{dialog.object}._localStorageSettings.namespace = "myNewNamespace";

I'd pull off the guid of the original namespace and append it to your new namespace. See how that turns out.

cptutrecht
08-02-2017, 04:58 PM
Thanks David, I will experiment with that.