Page 1 of 1

Resetting globals for all users

PostPosted: Fri Feb 18, 2005 4:36 pm
by Morley
I have a global date field which holds the user's current date choice. I want to reset the value to today shortly after midnight daily for all users.

Is this possible?

PostPosted: Fri Feb 18, 2005 4:43 pm
by ROCLASI
You can do this with the scheduler plugin I believe.
Ofcourse each client will have to change their own global field. You can't do it from the server.
But with the scheduler this should be no problem.

I hope this points you in the right direction.

PostPosted: Fri Feb 18, 2005 4:44 pm
by jcompagner
Start a scheduler at the start of youre solution that triggers around midnight.

PostPosted: Fri Feb 18, 2005 11:56 pm
by Morley
jcompagner wrote:Start a scheduler at the start of youre solution that triggers around midnight.
One of us is misunderstanding the other.

Already have a cron routine that runs just after midnight daily. As it stands, if the computer is left up and running over night, if the selected date was "today" yesterday, it's no longer "today" in the morning. Counter intuitive for the non-tech savvy user. Yes, all they need to do is click on today's date on the calendar and the screen is reset.

Is Robert correct? The server can't reset all users' global fields?

PostPosted: Sat Feb 19, 2005 12:27 am
by ROCLASI
The Servoy scheduler is in the scope of the client. Not the server. (I wish)
If you want to do something 'server-side' you need to have a client open on the server.
But because global variables are session specific you can't control them from the server. So you need to control them from within each client (and thus that session).
This is where the Scheduler plugin comes in.

PostPosted: Sat Feb 19, 2005 2:35 am
by Morley
ROCLASI wrote:The Servoy scheduler is in the scope of the client. Not the server. (I wish)
If you want to do something 'server-side' you need to have a client open on the server.
But because global variables are session specific you can't control them from the server. So you need to control them from within each client (and thus that session).
This is where the Scheduler plugin comes in.
Start a Scheduler routine when the user logs in that triggers shortly after midnight to reset the date variable? Yes, I can see how that might work. Thanks for the nudge. :D

However, this raises another issue not considered previously. I have an onSolutionOpen script which triggers the daily Cron, among other things right after the user logs in. This works fine on an isolated single user development system.

But is this the right setup for a server deployed solution? The way I've got it structured now the daily Cron will get set up each and every time a new user logs into the solution. Does this matter? Should I put the daily Cron into a separate routine that gets triggered just once when the solution is deployed on the server?

Until now I've been focused on building the internal routines, and deployment is now very close.

Your comments appreciated.

PostPosted: Sat Feb 19, 2005 9:54 am
by ROCLASI
Morley wrote:But is this the right setup for a server deployed solution? The way I've got it structured now the daily Cron will get set up each and every time a new user logs into the solution. Does this matter? Should I put the daily Cron into a separate routine that gets triggered just once when the solution is deployed on the server?

That depends on what your cronjob does.
You should ask yourself if you want that cronjob to be fired more then once. I.e. when you have 10 clients open it will fire 10 times.
If you want it only happening once you might wanna use a (headless?) client on the server that performs this task.

Hope this helps.

PostPosted: Sat Feb 19, 2005 6:53 pm
by Morley
ROCLASI wrote:That depends on what your cronjob does.
You should ask yourself if you want that cronjob to be fired more then once. I.e. when you have 10 clients open it will fire 10 times.
If you want it only happening once you might wanna use a (headless?) client on the server that performs this task.
A "headless" client? Not familiar terminology.

The daily Cron picks up all tasks that were scheduled to done today and rolls them over to the next day, and evaluates whether a client has slipped through the minimum window when they should be contacted and schedules an alert to the relevant sales rep.

In other words, daily housekeeping. Really only needs to be done once. The current daily Cron triggered by the user on log-in would be excellent for rolling over their global date field. I really need a separate housekeeping Cron routine to be triggered when the solution is deployed on the server.

Not having deployed a server as yet, I'm unsure what my options are.

Kind regards,

PostPosted: Mon Feb 21, 2005 1:42 pm
by ROCLASI
Morley wrote:A "headless" client? Not familiar terminology.


Servoy Headless Client. The web-enabled version of Servoy Client introduced last january.
You could trigger that client to stay open every x minutes like with a cronjob and wget.
And in the solution you could have a method that checks if the client is open on the same IP as the server so it knows it has to handle your cronjob stuff.

I guess you could do the same thing with Servoy Client. It's a matter of preference.


Hope this helps.