How to refresh data from tinyDB after adding a new data on it?

Based on what I observed after adding new data from tinyDB it doesn’t get the latest data that has been added like I need to navigate to other screen and back to it again so that it would refresh and so I can add another value, so I’m assuming more like refreshing the “Screen” to refresh the data that has been stored in tinyDB. I have search similar topic on this and here’s the blocks

REF

but it didn’t work out, is there a better way or what did I missed. thank you everyone!

This procedure doesn’t work in companion only in apk. Try this way and see if tinyDB refresh.

1 Like

Yep it does work how ever is there a way in refreshing TinyDB without refreshing the actual screen kinda odd.

What happens if after storing new data in tinydb you call tinydb get again ?

What are the values you are adding? If you use get value then no need of refresh

Yes, something like that because After adding a new data I’m trying to call the tinydb and get the value to check for the validation. Although you give an alternative solution which is refreshingScreen it does work well too.

Something like that ?

it’s only a string that I’m adding on it. I need some advice I’m declaring global variable which block is the best to use? Currently I’m using the upper one I’m just confused tho it gives an “X” represents for error but still it does it thing still giving me the output. what practice should I use here upper or bottom?

Untitled

No need of refresh

Tinydb - storing and getting value from a list - #19 by Vaibhav

Just save the value in a list and cl the list into a variable

Anyways thank you all! I already figured it out since I declared a global variable then put the tinydb get block that’s why I need to refresh the screen to it will get the updated data on it just like this image below;
Untitled1

The solution I made

Untitled

You asked about refreshing tinydb but actually the problem was how to declare global variable. You can’t at initialise declare one item inside another. For example you cannot set a tinydb tag value to a global variable

You have to create the variable, then set it in screen initialise for example

1 Like

Yeah I thought at first it’s about refreshing the tinydb but the fact is that I’m actually doing it wrong in getting the value from tinydb. And I did similar to yours atleast I learned something thanks dora!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.