Forum Moderators: open

Message Too Old, No Replies

Timing asp execution

         

fintan

2:36 pm on Feb 5, 2003 (gmt 0)

10+ Year Member



Hi
Is it possible to delay the execution of an asp script, I've been trying but with no luck.
Thanks

Xoc

3:47 pm on Feb 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, it depends. Do you want to just execute the script on a schedule? Or just delay execution by 10 minutes or whatever?

If you want to execute the script on a schedule, you can the script to the scheduler on the server that does the operation you want. If you want to delay execution, you can have the scheduler run it every minute, then check the times to see if the operation's time is ready yet. If your ISP doesn't let you access the scheduler, then you can create a hidden ASP page, and have a program on your local machine request that page at the given interval. Doesn't work so well with dial-up.

fintan

4:36 pm on Feb 5, 2003 (gmt 0)

10+ Year Member



I do most of my work on an intranet so I don't have to worry about alot of that. What I'm doing is using javascript to open a confirm box which opens a window. The new window fillters a record from the previous page. Now I keep getting a bof or eof error saying there is no record there. (This only happens when the record is update for the first time not when the record is updated for the second time). I know what the problem is. The new record is pulling the details from the database before the data can be entered.

So I need to delay it for 2-3 seconds. I'd like to do this with a script if at all possible. I don't want to go messing around with chillisoft or the linux box.
It's a bit confusing I know. Bassically what happens is.

A new record is entered but not all the details are assigned to that record yet. Then later the record is edited "1st time"

I'm starting to get confused myself.

Click on update and a cofirm box pops up. Click cancel. The record is updated but no other action is taken. Click OK and a popup window appears "This is where the record is filltered". While this is going on the update action is taking place.

The popup window is executing before the update action can enter the date into the database.

RossWal

5:48 pm on Feb 5, 2003 (gmt 0)

10+ Year Member



Fin,
Were it me, I think I'd try passing the data from the first page to the second, instead of a trip back to the database. If you need the delay try something like this:

RightNow = Timer()

While Timer() - RightNow < 3
Wend

I'm guessing at the sytax, and my guessing is often not so good, but this should get you started. Look at MSDN Scripting section for info on Timer. 4 Guys from Rolla also has an article. I think the timer() - RightNow will return fractions of seconds, like 2.46532 is about 2 and a half seconds.

Good luck,
Ross

fintan

8:51 am on Feb 6, 2003 (gmt 0)

10+ Year Member



I was doing something along the lines of this.

current = 0
Interval = 0

current = Second(Time)

While Interval < 5
Interval = Second(Time) - current
Wend

duckhunter

3:23 am on Feb 7, 2003 (gmt 0)

10+ Year Member



Seems like you need to know that the first execute has completed rather than waiting 3 or 5 seconds. Not sure if this will work, just an idea.

In your first page, initialize a Session variable to False like this: Set Session("UPDATE") = "FALSE"

When your first update completes, change the variable: Session("UPDATE") = "TRUE"

Then, in your wait state, look for Session("UPDATE") = "TRUE" before you execute the second update. Once complete, change the variable back to "FALSE".

Ideally, you would like to refresh the popup with javascript every 2 seconds rather than running the loop.
That loop runs the CPU through the roof.

fintan

11:35 am on Feb 7, 2003 (gmt 0)

10+ Year Member



Yeah I found that out the hard way. What I'm doing now is a work around. I was thinking of using javascript to pass on the reference number(All records are filltered by this.)

The ref no. "just the ref no. as it appears in html" onto an intermediate page then have that page open a window.
So in the code you will have something like this

/helpdesk/email/emailnotice.asp?callID=8752
on the intermediate page the "8752" being any number.

Then the final page opening and filltering the result. There you go it should work but then in theory alot of things should work and yes I am a glutten for punishment.
But thanks for the idea. Its seems a better way to do it, less mess. I'm going to try both see which one works better.
Thanks