 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
laiko
Joined: 11 Feb 2010 Posts: 43 Country: India |
|
Checking the database before job can run |
|
I have a job that checks the database before it can run. If the value in the database is 0, it will again check after 5 minutes. It will keep on checking for 20x (every 5 mins) or until the value in the db table is 1. Please help how to do that.
|
|
Fri Feb 12, 2010 7:01 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
Are you running 24x7 Windows or MP Version or 24x7 Event Server?
|
|
Fri Feb 12, 2010 9:41 am |
|
 |
laiko
Joined: 11 Feb 2010 Posts: 43 Country: India |
|
|
|
MP Version
|
|
Fri Feb 12, 2010 10:02 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
This is similar to the other job. Please see my response in the previous message thread.
Here you don't loop through all values, but repeat db checks until the number of tries is exhausted or the value is non zero
 |
 |
var i;
var result = 0;
for( i = 0; i < 19; i++)
{
Database.connect("profile name here");
result = Databse.retrieve("SELECT column_name FROM my_table");
Database.disconnect();
if (result != 0) break;
Scheduler.pause(300); // wait 5 minutes and tray again
}
if (result) // the value is not zero
{
// do something good here
}
else
Scheduler.raiseError(1001, "After 20 iterrations, the value in db is still zero");
|
|
|
Fri Feb 12, 2010 11:41 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|