Hello,
I noticed that my question on this topics had 28 views but no replies, so I figured if I worked it out, someone might be interested....
The problem I was having is that browsers have very short attention spans. Some of the analysis of our data takes a little time and when you allow people to do ad-hoc reporting you never really know how long a report will take to complete and display. So, while your app is dutifully performing it's task, the browser finally says 'This is boring...' and closes the connection. If the user clicks retry, the same report or process is restarted from the beginning. This can go on for quite a while with each new request being played out on it's own thread. Then the server gives up or you get a phone call.
My natural inclination is to start fiddling with the template (sorry Bruce) but I forced myself to stay away from that stuff and just make it work within the existing template.
I have 2 examples that required slightly different solutions. One is a process that validates and imports an uploaded datafile and the other is a report that produces a browse that takes just a little too long depending on the user's inputs.
Process -
My method requires 4 processes. - The cover page(COVERPAGE), the import process(IMPORTDATA), a tickler process(PUSHPACK) and the final landing form(SHOWRESULTS).
COVERPAGE a NetWebPage - I made this look like my normal site with the header, menu and footer stuff. This will call the import process.
To handle the coverup I need 3 HTML routines - SetRedirect, ShowWait & CloseWait
In order to know when the import is complete, I add a routine in the HTML - SetRedirect, no condition, Location: Inside <head>
Code -------------
<META HTTP-EQUIV="refresh" CONTENT="1;URL=ShowImportResults">
---------------
The refresh does not occur until the page is completely loaded and that won't happen until the import process returns.
ShowWait - Rouitine, Nocondition, Location: Inside Page
This displays a wait message and an animated book in a little iFrame window.
Code--------------
<p><BR /><BR /><BR /><BR /><BR /><BR /><BR /></p>
<iframe class="ImportCover"></iframe>
<p class="ImportCover">Please wait while your data is validated and the database is updated.<BR />
This may take several minutes . . . <BR />
<img src="images/book.gif" width="37" height="30" />
</p>
------------------
The CSS Selector - You can modify this to suit your own page. The trick is Absolute positioning and setting a known size.
.ImportCover {
left: 3em;
top: 7em;
height: 6em;
width: 40em;
position: absolute;
border: none;
background: #FFFFFF
}
----------------------------
CloseWait - Routine, No Condition, Location:Before </body>
This is necessary for browsers that don't handle redirects well. It offers a link to the results page.
Code --------------------
<iframe class="ImportCover">
</iframe>
<p class="ImportCover"><strong>The import process has completed. </strong><BR />
If you are not redirected, please click this link to go to the <a href="ShowImportResults">Import Results</a>
</p>
<!-- Net:PageFooterTag -->
-----------------------------
There is only one Embed in the COVERPAGE at the bottom of Routine.ShowWait. This displays the page generated so far and calls the importer.
Code ------------------
do sendpacket
importdata(p_web,curcompany) !Call to import process
-----------------
==========================================
IMPORTDATA - A standard clarion process to do importing into the database
Prototype: (NetWebServerWorker p_web, string p_CurComp)
Nothing real special here as far as the process. I did set the text in the progress window to show which company fwas being processed.
TAKERECORD embed after the actual import code I put the 'tickler' code-
Code-------------------
!remember to set bt=clock() somewhere before your process loop
if (clock() - bt) > 500
bt=clock()
pushpack(p_web,'<iframe class="ImportStatus"></iframe><span class="ImportStatus">'&Reccnt&' Records</span>')
end
--------------------
Every 5 seconds, we send a message to the browser. This keeps the browser interested in our page so it doesn't timeout.
The CSS Selector ImportStatus looks like this -
.ImportStatus {
left: 8em;
top: 10.5em;
height: 1em;
width: 30em;
position: absolute;
border: none;
background: #FFFFFF
}
This is designed to sit inside the iFrame on the coverpage and updates the number of records.
During the process, any errors found are writen to an HTML file in the company's data folder. Errors.html This is a static file that is displayed by SHOWRESULTS.
========================================
PUSHPACK - this sends a packet to the browser outside the usual webhandler for the current process.
PushPack PROCEDURE (NetWebServerWorker p_web, string p_packet)packetlen long
! End of "Data Section"
CODE
! Start of "Processed Code"
! [Priority 4000]
packetlen = len(clip(p_packet))
if packetlen > 0
p_web.ParseHTML(p_packet, 1, packetlen, NET:NoHeader)
p_packet = ''
packetlen = 0
end
=======================================
SHOWRESULTS - NetWebForm - This is the final resting place for the import process. It is a normal form but with no entry fields only the submit button which is labeled "Import Another File" which sends you back to the file upload page, and a close button which sends you to the Index page.
One HTML routine -
ShowErrors - Routine, No Condition, Location:After <body>
Code---------------
<H1><!-- Net:s:ImportErrorCnt --> Errors Found</H1> <BR>These records have not been added or updated. Please check your data and resubmit.<HR>
<<!-- Net:f:uploads\Errors.HTML --><<HR>
-----------------------
========================================
HTH,
Chris C
Editted - Included the Book.gif
[attachment deleted by admin]