How to create a cloud variable listener for a sub-bucket?

hi

say that cloud variables can be used as a replacement for firebase blocks I find it a bit light
it is not possible to have dynamic cloud variables let me explain checking a node we can do it but if it contains a set of buckets how do we know which bucket has been modified?

I tried

the problem with the firebase blocks it seems that they work in a random way and it’s not the first time that I use them
can you make variable clouds more powerful?

1 Like

Can you explain by giving an example?

There are two different types of each of the variable classes. Cloud variables can be static (design time) or dynamic (run time)

Static variables can be declared as follows:
image

Dynamic variables can be used as part of the code, like this

or check the value like this
image

I’m not sure if this answers your question but I thought it is nice to know

2 Likes

hi

I believe that my problem remains with the cloud variables I cannot detect the change of state of a lower node with this block

I have a “house” node which has a variable number of “piece” sub-elements
when I modify the “kitchen” sub-elements how do I know that it is “kitchen” and not “living room”?

1 Like

OK,
You have two options here

The more straight forward option is to use a timer to read the key required and check if the value stored has changed. Firebase allows up to (200,000 per second for paid plans or 100 per second for free plan)


database limits

I believe 10 or 20 times per second is a sufficient practical limit.

The other way is to create a bucket (monitoring key) that you will store any changes you make in your database along with the desired key.

With this, you can use the when initializes or change block to point to the monitoring key which will fire every time you update it whn you change anything in your database.

This can be done in the app itself or using a Firebase database function in the database.

1 Like

hi

it turns out that I have already tried with a timer but it flashes the dvl corresponding to the bucket that I am monitoring
in your second proposal, what bothers me is that my buckets are created dynamically and are used interchangeably and I do not see in the block above how to have it modified so that it corresponds to the modified bucket
I had to leave all my energy on the clones :pensive:

1 Like

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