Variable is not loading from database, and initialized value is used instead

Hello folks!
In my program I have the boolean variable "AktivFiltrering", which should decide whether the text label: "StatusLabelLabelForFiltrering" text is green or red, and what it says. I can see that the value is saved to the firebase database, but when I initialize the screen, the text label keeps displaying the value which is in the "Initialize global AktivFiltrering to false", instead of the value that is shown on my firebase database, and therefore also the TinyDB, which must have the same value.

I have truly gotten tunnel vision on this issue, and any help would be appreciated, hope you can give it a go.

This works for me

I just adjusted it to look like yours, but now the outcome of loading in the variables seems to rely on the "ValueIfTagNotThere" value (whatever the boolean value is in the "PumpeFiltreringAktivTBD" tag, it only shows displays the valueTagIfNotThere = false, and changes accordingly when I change it to true), even though it's getting saved in the same tag, do you have any idea about what could be going on?

The app is used on several devices? If yes, only use Firebase rather than trying to store and read the same value from 2 different databases

Read the values from Firebase before displaying anything on your screen and in case there is nothing stored in Firebase ( I.e.first run of the app) then display the initial value


Hi Taifun, the idea is to make the the app change values in Firebase, which a single device is then supposed to read, and make changes to too, but the problem I ran into was that I couldn't find a way to assign a value to a variable from Firebase, I only found this possible from TinyDB, since it didn't have the orange block featured in this picture.
Do you believe that the multiple databases are the problems, and do you have a way to assign variables values from the database upon initializing?

You did not understand the concept of asynchronous processing... to get a value from Firebase takes a little bit of time, therefore there is an event called GotValue to receive values from the database




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