How can we I get and compare the values of 2 tags in my database when firebase data changes?

In my app, i need to send a ntification to the user when the tag notStatus shown below in my firebase changes from 0 to 1.

when this change occurs, the app should check if the value of the tag BattCharge is <=60 and if so sends a notification to the user to perform certain action.

It is not the notification part I am worried about, it is the fetching of one tag, checking if it is =1, and then fetching and checking the value of another tag.

I was able to do so when I was checking for only one tag using the following blocks:

Firebase:
fb

if you app ant to work in background task then try this extension (credit @Kumaraswamy)

Under the current If/then block, add another "call FirebaseDB1.GetValue" for the tag of your choice. Next, extend the 'if/then' block to become an 'if/then/elseIf/then' block. Under 'elseIf', check the tag as you have done under the 'if' portion for the second tag you want to retrieve. Put the method you want to run under the second 'then' section.

Hope this helps.

I'm not sure I understand because if I were to write it in code it would look as follows:

When( Firbase. DataChanged)
{
If (notStatus == 1 && BattCharge <=60)
then ( send notification to application)
}

how do i get the value of notStatus first and test if it is ==1 then proceed to get the value of BattCharge and test for condition?

Try this:

image

it did not work
any idea what is wrong with the picture below?

  1. When the data changes, you call procedure2. It gets the data for the tag, and returns:
    tag = data/BattCharge
    value = 1 (for sake of illustration)
    GotValue is raised, and the result is true, it will then proceed to call procedure2 again, and the cycle will continue until value = 0.

  2. The second 'if' statement is contained in the first. This means that the tag BattCharge will only be handled if the tag is notStatus (and obviously BattCharge is not notStatus).


This can be done without the procedure blocks. Try the following if you want to get notStatus only if BattCharge = 1: