I need to store a list a values each time. In other words can I add new values each time and they will be stored inside the local storage. for example I need to save a new location with different name. unfortunately the previous information get overridden.
Yes you can. It should be the Local Storage not Local DB.
Show your block to see why you have this overwriting issue.
i dont know if i understand you right
but check this if will work for you
Fist am adding the text box to a sub-list called locList, then am adding that sub-list into the main List called listMain. and finally am saving the main list into the Local storage
my block to add new entries is:
You might find this easier if you use stored variables in your app.
You could also save all of these details as properties of an Object, and have a list of Objects in your app.
It also looks like your Get blocks retrieve a single item of the list at a time (for each item
j in list…) but then treat this item
j as a list. What are you hoping to do here? What do you see when these blocks execute?
Please bader_mouti. in your code you used
User-Id OR Username as a key, is that means there will be two keys?, what if I have five inputs like:
in that case should i use:
User-Name OR Address OR Mobile OR job OR Salary
Hi Jane, please clarify, something to me, my understand is that if we use localstorage, the information will stay on my Mobile and I can’t share it, they only for displaying certain information about my system, and mostly used for setting purposed. That means to my understand both Locatstorage and stored variable have the same function, storing data mostly for settings, and private information.???
No I just write User-ID OR User name
To explain to you that you can use any of them as a key
If you have 5 inputs you need just 1 Key and all your inputs will be saved under that key
Or, you can use objects inside your stored variables.
They do, but the stored variable blocks are easier to work with. (They can also be used to store other data types, including media, unlike the Local Storage component, but that’s not relevant here!)
For example, looking at your first screenshot, you could save
locListMain as a stored variable, and then you can save it between app sessions and retrieve its data easily! No need for the Local Storage blocks at all, no extra blocks needed. You would simply be saving
locListMain as a stored variable instead of an app variable.
Thank you bader_mouti. please how to store multiple values under one key.
The key is : location
and under that key I have multiple locations:
and so on
it will be like this
and you can use any thing to save the value Text_ input or …
and when you want to get value its will be like this
Thank you for the reply
my questions is it one time entry, which means next time I used the key “location”, the data stay or get over-written, In other words can i keep the previous data all together with the new entries
If you can tell me what you’re trying to do, maybe I can help you better
Thank you bader_mouti
what am trying to is that:
I want to store different locations. for example in my city (which is the main key) I have different locations, with different names, address and even latitudes, and longitude address. I want to store them locally in my app
I my city, which is called Salalah, I have different locations, I want to store these location under the name Salalah, but I have location 1, which may have different information like, name, address, latitude, longitude, and so on with location 2, and location 3…
like this you will save different locations under your city name
in the image below you can change ( location Number 1 )
for ( location Number 2 ) and like this you will save 2 location withe details under your city name
Thank you, bader_mouti…i will try it now, but please… how to retrieve the values, i think it will be a very complicated process, sorry to say that, am still a beginner in thunkable…
no problem, it’s so easy
but where you want retrieve the values
in data Data_Viewer_List1 or in label or … ??
so i can make example for you