ASP Classic Flush?

I'm doing some ASP classic work for a client. I'm well versed at Cold Fusion and there is a CF tag called cfflush that allows large amounts of data to be outputed to the browser as it becomes available.

Is there a similar tag in ASP Classic? I'm processing close to a thousand rows of data and I need the progress to update in real time in the browser window.

Thanks,

Brent
 
Thanks DB. That should have been obvious to me. However, I just tried it with 500 rows and it still waited to output until the entire process was completed.

Here is the code:

Code:
			Response.write "<table class=""vTable"">"
			Response.write "<tr>"
			'column heads
			Response.write "<td>Internal ID</td><td>VIN</td><td>Tag</td><td>Tag State</td><td>Year</td><td>Make</td><td>Model</td><td>Series</td>"
			Response.write "<td>Color</td><td>Location Address</td><td>Location State</td><td>Locatspamip</td><td>Add. Location</td><td>Contact</td><td>Contact Phone</td><td>Available</td><td>Comment</td>"
			'end column heads
			Response.write "</tr>"
			for z = 1 to UBound(aInternalID)
				response.buffer = true
	   			response.write "<tr>"
				response.write "<td>" & aInternalID(z) & "</td>"
				response.write "<td>" & aVIN(z) &  "</td>"
				response.write "<td>" & aTag(z)  & "</td>"
				response.write "<td>" & aTagState(z)  & "</td>"
				response.write "<td>" & aYear(z) &  "</td>"
				response.write "<td>" & aMake(z)  & "</td>"
				response.write "<td>" & aModel(z)  & "</td>"
				response.write "<td>" & aSeries(z) &  "</td>"
				response.write "<td>" & aColor(z)  & "</td>"
				response.write "<td>" & aLocAddress(z) & "</td>"
				response.write "<td>" & aLocState(z) &  "</td>"
				response.write "<td>" & aLocZip(z) &  "</td>"
				response.write "<td>" & aLocAdd(z) & "</td>" 
				response.write "<td>" & aContact(z)  & "</td>"
				response.write "<td>" & aContactPhone(z) &  "</td>" 
				response.write "<td>" & aAvailable(z) &  "</td>" 
				response.write "<td>" & aComment(z) &  "</td>"
				response.write "</tr>"
				response.Flush()		   
	    	next 
			response.write "</table>"


Any thoughts?

This is my first try at trying to make this look like it's a real dynamic page. What I would like to do is load the html for the page and then dynamically add the rows to the table as they are processed. I've been looking for some sort of code(perhaps javascript?) that would allow me to do this, but I haven't had any luck as of now.
 
DirtBag said:
Response.Flush is a command and I think it's what you are looking for

This method sends buffered output immediately.
If you use this, don't forget to set Response.Buffer = True.

riley
 
The reason you don't see the page being built is most likely because it's one large table, and the browser is waiting for the </table> tag before being able to render it.
 
Yes, I read that. I've been looking for some sort of solution.

I read that I could use javascript to enter new rows in an existing table while the data is being processed. I'm just trying to figure out how to call the javascript while in the middle of the FOR NEXT.

Would it work if I just used DIVS instead of tables? The only reason I was using tables is because I need to get this done fairly quickly.

I'll keep looking for the solution. If you have any thoughts, I'd love to hear them.

Thanks,

Brent
 
DIVS worked well.

Now, what I would like to do is write the header and the footer of the html document and then fill the center DIV with the output as if it were an inner screen.

As of now I'm writing the header and then a few minutes of data flushing and then the footer.

I'm guessing I will have to use JS for this unless any of you fellas have a better idea.

Thanks again,

Brent
 
as the script is processed from top to bottom and the footer is at the bottom, this will have to be done on the client side. most likely with for example javascript. I don't know how to do it, but I think this is the way it has to be done..




Thank you riley for pointing out that :) didn't think about it
 
SubSpace said:
The reason you don't see the page being built is most likely because it's one large table, and the browser is waiting for the </table> tag before being able to render it.

If this is the case, simply display each row as it's own table so that the "table" is really a series of tables. Set each cell within each table to the same width so that all the cells line up.
 
Thanks again. I thought about using multiple tables but I want to display the footer before the flush.

I've got it working now. I'm writing the header, a container DIV, and the footer. Then I'm processing the data and updating the innerhtml property of the DIV using Javascript. It's almost working well so far.

Here is the function (please bare with me, it's a cut and paste job):
<script language='JavaScript'>
<!--
function writeFileRow(lyr,sTemp)
{
if (document.all)
{
// IE version
try {

document.getElementById(lyr).innerHTML=document.getElementById(lyr).innerHTML + sTemp;
}

catch (e) {

document.getElementById(lyr).innerHTML=document.getElementById(lyr).innerHTML + Temp;
}
}
else
{
// Mozilla/Netscrap 6+ version
document.getElementById(lyr).innerHTML=document.getElementById(lyr).innerHTML + Temp;
}
}
//-->
</script>

Here is the ASP code I'm using to call the function:
for z = 1 to UBound(aInternalID)
response.buffer = true
sTemp = "<DIV class=""vDivRow"">"

sTemp = sTemp & " <DIV class=""vDiv1"">" & aVIN(z) & "</DIV>"
sTemp = sTemp & " <DIV class=""vDiv2"">" & aTag(z) & " " & aTagState(z) & "</DIV>"
sTemp = sTemp & " <DIV class=""vDiv3"">" & aYear(z) & " " & aMake(z) & " " & aModel(z) & " " & aSeries(z) & " " & aColor(z) & "</DIV>"
sTemp = sTemp & " <DIV class=""vDiv4"">" & aLocAddress(z) & " " & aLocState(z) & " " & aLocZip(z) & " " & aLocAdd(z) & "</DIV>"
sTemp = sTemp & " <DIV class=""vDiv5"">" & aContact(z) & " " & aContactPhone(z) & "</DIV>"
sTemp = sTemp & " <DIV class=""vDiv6"">" & aAvailable(z) & "</DIV>"
sTemp = sTemp & " <DIV class=""vDiv7"">" & aComment(z) & "</DIV>"
sTemp = sTemp & "</DIV>"
response.write "<script language=""JavaScript"">"

response.write "writeFileRow('fileContents','" & sTemp & "');"
response.write "</script>"

response.Flush()
next

"fileContents" is the Container DIV.

So, this is working almost perfectly. The problem....It replaces the entire innerHTML content every time so the screen flashes for every row I process. Is there a way in Javascript to just append to the innerhtml rather than replace?

The only other task I would like to accomplish with this is to keep the focus at the bottom of the scrolled DIV while the rows are being added.

Thanks a lot for all your ideas. I'm still looking for a bit more, if you're able to.
 
Back
Top