I would like to know if you can help me about an access to the firebase in a module (but it seems that it is the same thing with all variables).
If I launch my app for the first time, I have an error with variables.
For instance; when I access (with a button) to a page to get a variable in a firebase, I can’t obtain it the first time I click.
If I return back with the previous button on the Android phone and click again, the access to the correct value is possible.
I can’t understand why I need to go back ? Is there something to do to get the correct value of the distant variable on the first time I click ?
In my example, I load a page with these blocks from another page. I’m using live test.
I try to find in a firebase the rank of an user (I use the email as an ID).
If I find it, I use the “i” value to say that it is the rank of the email found.
Systematically when I launch for the first time these blocks, the results is 0 for my variables and the return of the firebase is null. But If I go back with the return android button and load another time the page, I obtain the correct variable value and the correct access to the firebase.
It is as if I needed to refresh or to pre-connect the base… I don’t know why…
Someone would have an idea ?
“palmares/” + “/” …
It may not be your issue but I’m not sure if you are aware you have two forward slashes in your get key. This has caught me out in the past.
You’re right, this is a mistake…
… and I change the block …
… but the problem is not solved
The firebase block is an asynchronous block. it means it will run and the next blocks while “getting” results in the firebase is completed. So your loop is probably running already before the NbPart is loaded. if the subsequent process depended on the results of the firebase get block, try putting them all them in side “then do” area. That will guarantee you have the NbPart loaded. Makes sense because when you do it again, the NbPart have been loaded already albeit the previous time’s value.
Hope this works for you.
Thank you very much for this explanation. I understand the reason why it doesn’t work.I have just a problem to really understand you’re sentence (i’m french) : what do you mean with “putting them all in side then do area”… +++
Another solution is to use the cloud variables to reference keys in a firebase db.
Here is a link to the thread How can i pull all data in firebase to list in thunkable? - #16 by drted
Oh yeah… Smart solution… I will try this…
Just a thing, the cloud is the thunkable cloud ? Which cloud is available ?
The cloud variables use firebase. Check out the thunkable docs for more details
Yes this will work also. Alot simpler.
Thanks… IT works better now…
Merci beaucoup ++