Creating and Working With a Keyed Object Variable

Hey everyone…

I want to create a local storage variable which is a keyed object.

The index will be a number, and the value will be a boolean. The index values will be non-continous, so it may look like this:

show_help[1000] = 0
show_help[1010] = 0
show_help[1020] = 0
show_help[1130] = 0

So the structure is like a show_help object, with an integer index field and a boolean value field.

There will be around 100 non-continuous elements I want to access.

I know how to initialise this from the database and bring it into app connect. However I would prefer not to hit the database with this and instead to create it all locally on the client side.

So my questions are:

  1. How do I declare such a structure.
  2. How can I initialse all the 100 different values (which will all initialise to 0)
  3. How do I access the values within Wappler.

I’ve tried reading lots of different bits of documentation and forum posts and experimented quite a lot but I’m still not clear how to approach this!

Best wishes,
Antony.

I know this is not answering your question, but anyway…
Given you want to store this data using local storage, why not hit the database - but just once - and cache the results.

Hi @TomD… yes, I may well do that… but I want to understand more about working with local data structures as I have many other temporary storage requirements with complex structures, so am curious to better understand how all the local storage works beyond the use of simple one dimensional variables or simple arrays!