Dealing with delay in processing

D

Doogie

Hi,
I am trying to modify an ASP 3.0 app and am running into an issue.
Essentially the part that I'm modifying queries the database and
returns a record count. This part is done using
"Microsoft.XMLHTTP".

The call to the database has a very slight delay (not sure if it's
cause of our code or the Microsoft object). But the app does not
wait
for the data call to return before processing the rest of the
functionality in the method. So my check on the record count is
always 0, even though sometimes there are records in there (because
the variable I assign the record count to does not get set before the
check on that variable is done).


I have been looking at ways to pause apps in java and came across
setInterval and clearInterval. But that is not working like I'd
expect. Here's what I'd like to do:


1. Call my db method (where the record count variable is assigned).
2. Use setInterval to wait until that record count variable is
actually set.
3. Proceed with my code.


I may not understand how the set and clear interval methods work so
am
posting some of the code. This code has two problems:
1. It does not clear out the interval like I'd expect - it's as
if
the interval value is different each time (which make sense but I'm
not sure how to set it up to perform that work I put in the check
detail count method otherwise):
2. It runs the CompleteInvoice piece without waiting on the
setInterval piece to stop. So I'm still in the same boat as before.


Any help would be greatly appreciated!


function CallComplete()
{
var numberOfInvoiceRows =
spnTableDisplay.firstChild.tBodies[0].rows.length


for(var index = 0; index < numberOfInvoiceRows; index++)
{
g_TotalDetailRows = -1 --THIS IS MY RECORD COUNT VARIABLE
var rowObj =
spnTableDisplay.firstChild.tBodies[0].rows[index]
GetDetails(rowObj) --INSIDE THIS METHOD THE RECORD COUNT
VARIABLE IS SET
vendorType =
rowObj.cells[2].children("txt_VENDOR_TYPE_AN").value
interval = setInterval("CheckDetailCount()", 1000)
}


CompleteInvoice()



}


function CheckDetailCount()
{
if (g_TotalDetailRows != -1)
{
clearInterval(interval)
if (g_TotalDetailRows < 1)
{
alert("The invoice row for vendor type '" + vendorType +
"'
does not have a detail row.")
return
}
}
 
L

Lew

Doogie said:
Hi,
I am trying to modify an ASP 3.0 app and am running into an issue.

This is a Java newsgroup.
Essentially the part that I'm modifying queries the database and
returns a record count. This part is done using
"Microsoft.XMLHTTP".
...
I have been looking at ways to pause apps in java and came across

You show us no Java. This is a Java newsgroup.
setInterval and clearInterval. But that is not working like I'd
expect. Here's what I'd like to do:
1. Call my db method (where the record count variable is assigned).
2. Use setInterval to wait until that record count variable is
actually set.
3. Proceed with my code.


I may not understand how the set and clear interval methods work so
am
posting some of the code. This code has two problems:

It's not Java, and this is a Java newsgroup.
function CallComplete()

This is not Java syntax.
{
var numberOfInvoiceRows =

Not Java syntax.
spnTableDisplay.firstChild.tBodies[0].rows.length


for(var index = 0; index < numberOfInvoiceRows; index++)
{

Sorry. You are not using Java.
 
D

Doogie

Thanks for the help. :)

what is the difference between java and java script (for my
information)?
 
L

Lew

Doogie said:

Basically, they are just different languages, like, say, BASIC and FORTRAN.
Or PHP and Ruby. Or SNOBOL and COBOL.

Briefly, Javascript is a (primarily) client-side scripting language with
dynamic typing and no compilation phase. Java is a full-bore, strongly-typed
object-oriented computer language that has a compilation phase. Typically,
Javascript runs directly in a user's browser on the client machine. Java code
runs just about anywhere, in or out of browsers, client or server.
 
A

Andrew Thompson

Lew wrote:
..
..Java is a full-bore, strongly-typed
object-oriented computer language that has a compilation phase. Typically,
Javascript runs directly in a user's browser on the client machine.

I always find it odd when people mention that Java
is an OO* language, but fail to mention that ..so is
JavaScript!

(*Though admittedly, your OO comment was immediately
preceded by *strongly* *typed*, whereas JS is not strongly
typed, so perhaps I am reading too much into the mention
of 'OO'.)
 
L

Lew

Andrew said:
I always find it odd when people mention that Java
is an OO* language, but fail to mention that ..so is
JavaScript!

(*Though admittedly, your OO comment was immediately
preceded by *strongly* *typed*, whereas JS is not strongly
typed, so perhaps I am reading too much into the mention
of 'OO'.)

Javascript does support a flavor of object manipulation. I consider it not
enough to represent the orientation of the language. Java is almost so
object-oriented you'd have to call it an "object-obsessed" language.
(Autoboxing is Java's way of covering its embarrassment at having primitives
about.)

And, yes, I did use the phrase "strongly-typed" for Java. You are correct
that I deem that the more significant part of that particular comparison.

My intent wasn't to comprehensively compare the languages but to provide to
the OP enough information to honor their question and to portray that the
languages are, indeed, different.
 
A

Andrew Thompson

L

Lew

Andrew said:

An ellipsis comprises three period characters and should be set off by a
single space.

(Just giving you a poke in the ribs, there, Andrew.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top