Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stuck in a loop

Status
Not open for further replies.

gooseriver

IS-IT--Management
Aug 4, 2006
93
CA
I am checking the status of a scheduled report. I need to use a loop in which I check the status of the scheduled job when the "status" is = 1 then exit the loop...

I tried this and it did not work it stays in the loop..

Dim infoObjects

Set infoObjects = IStore.Query("Select Top 1* From CI_INFOOBJECTS Where SI_NAME='Universe Report'")

Dim report
Set report = infoObjects.Item(1)

do until status = 1
Dim infoObjects

Set infoObjects = IStore.Query("Select Top 1* From CI_INFOOBJECTS Where SI_NAME='Universe Report'")
loop

 

where do you change the value of status inside the loop ?

where do you set status in the first place ?

what are you trying to achieve ? A page that stops responding until the report is 'ready' - when does it get completed ? how long should the user wait ?

Your continual loop will thrash your processor - watch the task manager window on the web server when you run this script.

maybe a rethink of your requirements and design is in order? Either way, you will need to explain yourself a little more than you have.

A smile is worth a thousand kind words. So smile, it's easy! :)
 
I see that you are not having much success on these forums, with 33 questions asked, and not a single one marked as helpful! Try faq222-2244 to see how the forums work. If you're not getting helpful answers the FAQ will help you ask better ones - if you are, it will show you how to recognise them.

For this question:
Looks like you are continually resetting the object inside the loop
do until status = 1
Dim infoObjects

Set infoObjects = IStore.Query("Select Top 1* From CI_INFOOBJECTS Where SI_NAME='Universe Report'")
loop

Maybe you should check to see if your object (whatever it is) has a State_Changed event. Otherwise as a minimum you will need :
1. to stop resetting the object in the loop
2. actually read status in the loop
3. use doevents within the loop to release the processor

As Damber says - maybe a rethink of your requirements and design is in order?

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top