What should I put when no value is found

Hey !

I have a major issue.

I’m gathering data from firebase, but whatever I enter (data present or not in the database) I always get the else part of my if condition showed below :

image

I’m 100% sure the issue is in the if condition because when I remove it everything works fine. What should i put in value = ?

PS : I also tried changing value to the “namee” variable but nothing will do

So please can someone make a post with an explanation on when to use an empty string, when to use the "null" string and when to use the null block ? :thinking:

Thanks for helping !
Nice day :slight_smile:

1 Like

Here I have an example screenshot :

The part in green doesn’t work at all
The part in red only works when the if condition is removed

Hope it helps !

Hey @AcrobatEpee,

if you use RealtimeDB, you have to use the green null-block. You find it under the other “Logic”-blocks.

Keep thunking,

User81

1 Like

Hey @User81 ! Thanks for the info !

What should I use when I use a Localstorage and when I use a variable ?

Thank you !

1 Like

and always check your “value”-components twice. sometimes they mess up and you have to clear them all and then get them again from the right purple sourceblock.

1 Like

I’ll do that very often, thanks for the tip !

In this fonction I never get the choice to the value 1 even if the condition is fulfilled, do you see a reason to that ? Thanks !

Have a great day @User81 !

yes, I see the reason very clear: you remember that the repeat loop is like sending people to bring a beer? :slight_smile:
the repeat loop will be done in 5 milliseconds, then label… in 1 millisecond, then if…then…else if… in 5 milliseconds.

And then after 500 -3000 milliseconds the then-do-section will trigger(people come back with beer and count is set.

by the way: was the null-problem solved?

Oh yeah that loop. I should start watching and understanding this one so I can fix all my issues.

Ans yeah the null problem was fixed thanks to you !

Just a note that in almost all cases the best and easiest way to check for an error in a 'then do' section of a block is to simply test for 'if error'. That is:

51%20PM

That 'error' value will be a string describing the error.

Unfortunately the Local Storage component is the one case where we don’t (yet) provide an 'error' block. We do, however, return the string “null” when there is no value from the Get block for the given key. The choice of returning a string, rather than a real null value (i.e. the “green null block”) was probably a bad choice on our part :frowning:

-Mark

1 Like

We’ll deal with it, thanks for the info !