Real time for calculation

Hi,

I use a calcutation to return a date.

I would like to know if it’s possible to refresh automaticly this calcution without change to another form and go back to the correct form.

Regards, :wink:

Hi Fabien

This should do it

databaseManager.recalculate(//recalculates the record or all the records in the given foundset
//It can be needed in case records are inserted outside servoy
//please use with care, this can be expensive!
databaseManager.recalculate(foundset.getRecord(1));
//databaseManager.recalculate(foundset);
)

Can also be used through relationship to target specific record(s) - databaseManager.recalculate(parent_to_child);

Graham Greensall
Worxinfo Ltd

Ok thanks,

In fact, I would like to just look my screen , don’t push any button and refresh this date calculation every second.

If I use a ‘while’ with a sleep I can’t do nothing else :confused:

Is it possible to create a thread in Servoy?

You could set up a ‘cron’ job to do this - see Plugins - Scheduler.

However firing the cron job every second might result in a lot of network traffic if you have lots of Clients using the system. It appears that the Cron does not create a seperate thread so if you have another Method running it will not fire until that Method has completed.

Graham Greensall
Worxinfo Ltd

Ok thanks,

I wil test it :wink:

Question:
Why do you want it to update every second ?

Could it be that you need it to be updated based upon an activity taking place and it could be driven by an onDataChange event or similar ?

Cheers
Harry

We use a “waiting room” and we have a calcution who show since how long is a person in this room.

Therefore we want that this calcutation update every second

Fabien

Would it not be possible to poll the time say once a minute and then get the exact time to the second when a person leaves the room?

Graham Greensall
Worxinfo Ltd

Hi,

Ah, I see !

For this sort of purpose you may be better off looking for a java bean timer component which may do this for you.

Given that you will not be able to run this process natively as a separate thread in Servoy, this could be the best way to implement it.

Perhaps this may get some input from those forum members who are skilled in Java bean and plugin development who can say what is possible - and maybe whether it already exists somewhere !

Cheers
Harry

Ok
I think I will develop a Java bean :wink: