SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Checking the database before job can run

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Checking the database before job can run
Author Message
laiko



Joined: 11 Feb 2010
Posts: 43
Country: India

Post Checking the database before job can run Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7952

Post Reply with quote
Are you running 24x7 Windows or MP Version or 24x7 Event Server?
Fri Feb 12, 2010 9:41 am View user's profile Send private message
laiko



Joined: 11 Feb 2010
Posts: 43
Country: India

Post Reply with quote
MP Version
Fri Feb 12, 2010 10:02 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7952

Post Reply with quote
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

Code:

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 View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.