Is it possible for a coldfusion page to launch another template, but not in the user's browser

I have a test/quiz built in ColdFusion 9, and when the user hits the last page, I would like that to trigger a page that actually does the scoring and writing the report.

But I don't want the user to see any of that.

Also, in case the user closes their browser or moves to another page after they hit the last test page, I don't want that to interrupt the scoring and report writing which can take a few seconds.

So the scoring and reporting can't be running on the users browser.  Needs to be running in something like a browser opened by the system.

Currently I run the scoring and report writing as a scheduled task that runs every 2 minutes.  I'd like to get rid of the scheduled task because it runs whether or not there are any tests to process.

Another reason to get rid of the scheduled task is that even the 2 minute delay in getting test results can upset the customers who paid a premium to get their results immediately.  Other customers pay a budget price and get their reports on the next day.

Any suggestions?
Who is Participating?
Why not just show the user a "Processing..." page?   It seems they need to know that something is happending, otherwise, they may leave the page.

For example, on your last page, you could have a hidden CFDIV that processing the task so the user cannot see it.  But the user won't know something is happening, so they may try to leave the page and interupt the processing.

You could launch a seperate thread on your last page, but then you still need some type of processing page to watch for the thread completion.

I think the best way is to show a processing message while you run the results...

bigmikey88Author Commented:
Hi gdemaria,

thx for fast response

The reason I don't want to show users that something is processing, is for marketing / commercial reasons.  Certain people will pay a higher price and others prefer to get the lowest price even if they have to wait a day  for their results.  

This lets us offer a budget price and then a premium price with the only difference being the delivery time.

It was a way to offer the customer a choice.  Sort of like when you go to Sears and see 3 choices - good, better, best.

So how can I start a separate thread?


For the sake of discussion, let's say the processing takes 2 minutes.

The challenge is that once the user is done with the test, there is 2 minutes before the results can be shown.  So what do you do with the user for those two minutes and how do you let the user know what the time is up and the report is ready?

If you start a seperate thread, you can allow the user to browse through the pages on the website, but wouldn't the user still know that he/she doesn't have the report yet?  Isn't he/she waiting for the report at this time?   What can you have the user do while waiting those two minutes, whether you start a new thread and allow them to browse around (for no reason) or you show a processing statement... is there really a difference?    

It seems to me, without knowing a bunch about your app, that a 2 minute wait is "immediate" and worth spending more money over a 24 hour turn around time..  It doesn't seem it has to be 5 seconds to be worth the extra money as 2 minutes is much faster than 24 hours..

Speaking of which, did you really try tuning this app?   I have a processing program that generates 3-5,000 records and loops through most of them while processing.  It used to take 3-5 minutes, now, after I tuned it, it takes 20 seconds.    

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

<cfthread> is the command to start a new thread, I just don't know if it will get you anywhere because the user has nothing else to do, except wait for the results, true or not?
bigmikey88Author Commented:
The app I've been running gives the user a page which tell them when to come back for their test results.

It also suggests some other things they can do on the site.

I will have to think about what you have said.  I might just be stuck in an old way of thinking.

I am tuning / rewriting the entire app right now.  It is possible I can make it fast enough to just tack it on to the end of the test.

> The app I've been running gives the user a page which tell them when to come back for their test results.

I understand that if they are the higher paying subscriber, that you don't want them to have to come back for the results.   My suggestion to resolve this is to (1) tune the app so it runs faster and (2) to show them a processing page (just like all the major travel sites) and let them know that their results will be "immediate", while you wait... so they have to wait a minute for it, it's better than coming back the next day...

If a bunch of your code is SQL statements, you can very well improve the speed by adding indexes.  I put a time stamp before every segment of my code (ie.  "Now adding section I results..."  with date/time)    I looked at the SQL that took the longest and added indexes to make it run faster.   It really really helped.

bigmikey88Author Commented:
good idea

let me get back to you on that
bigmikey88Author Commented:

I've decided to try the approach you suggest.

I've done a new flow chart for this new process and it makes sense.

Thanks for your insight.

bigmikey88Author Commented:
great advice

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.