How to detect when a variable changes value, without the need for a Clock

I don’t like the idea of having a clock constantly checking with an interval of 10 milliseconds, is there any other way?

Use an indirect “setter” module wherever you are changing the variable’s value. The setter would basically do this:

def set(value):
    variable = value
    # You have now detected a change of value.
    # Do as you please.


Blocks equivalent:


Why don’t you use firebase?

When there is a change in a data saved in firebase you can make something happen

Would you use a cloud storage service instead of global variables for a simple calculator app? :slight_smile:

Answer the post without radically changing his setup, as long as the original setup isn’t too niche to get working. :slight_smile:


Where do you say it is a calculating app? I think that to get good answers you have to ask the questions well, don’t you think?

I’m going to try it, it’s just a value hosted on my tinydbWEB, since the component doesn’t have the block that detects if there is change in real time, then I needed a method without using the clock.

I am using TinyDB WEB since Firebase is very expensive for me, besides that in just a few hours it eats 10 GB.

I just want to verify that the variable changes in real time from my panel, if this variable is used to ban users and give credits.

BANEADO variable
It’s true = 1
It is false = 0

CREDIT variables:
Users receive credits and must change in real time, I had problems with the clock in many users, they left the app in the background (Previously open) and when they reopened it gave them an error.

“The application has stopped”

It’s true what you say about firebase… has happened to me…
The problem is that if you don’t use the clock, you would have to use some service in the cloud…

kodular still does not have the service in the background, so you have to use the clock or some solution such as firebase or something similar, to verify in real time if a variable changes.

Have you tried airtable? I think it’s less restrictive than firebase. And it has a block that makes something happen when the value of a cell is changed…


Remember with the clock to be careful to close one screen when you open another, because otherwise you will have a clock running on one screen and another clock on another screen… maybe that will cause an error

And how Airtable knows that data has been changed.

When you send data to a cell, airtable detects if you have changed the value of that cell. And an event is triggered.
Something like this:

Here you can see the airtable table with the row and column (the cell will change value):

Here you send the value to the cell (if you have a lot of data there are ways to know the row number of the value you want to change)
The Cell.changed event is activated when you enter the value in the cell and do something. Here I put a notifier, but you can put what you need to be done…

In the mobile the result:

It was an analogy to explain that global variables can in no way be replaced meaningfully by cloud storage.

If so then a change can be detected either from setter method or by checking it at regular intervals.
So @Kanishka_Developer has provided correct and final solution which will work definitely.

1 Like

Thanks very much, is perfect.

1 Like

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