Resetting globals for all users

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Resetting globals for all users

Postby Morley » Fri Feb 18, 2005 4:36 pm

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?
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby ROCLASI » Fri Feb 18, 2005 4:43 pm

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.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby jcompagner » Fri Feb 18, 2005 4:44 pm

Start a scheduler at the start of youre solution that triggers around midnight.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8839
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby Morley » Fri Feb 18, 2005 11:56 pm

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?
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby ROCLASI » Sat Feb 19, 2005 12:27 am

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.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby Morley » Sat Feb 19, 2005 2:35 am

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.
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby ROCLASI » Sat Feb 19, 2005 9:54 am

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.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby Morley » Sat Feb 19, 2005 6:53 pm

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,
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby ROCLASI » Mon Feb 21, 2005 1:42 pm

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.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 2 guests