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

Posted on 2011-04-24
Medium Priority
Last Modified: 2012-05-11
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?
Question by:bigmikey88
  • 5
  • 4
LVL 39

Accepted Solution

gdemaria earned 2000 total points
ID: 35456532
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...


Author Comment

ID: 35456579
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?

LVL 39

Expert Comment

ID: 35456734

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.

LVL 39

Expert Comment

ID: 35456783
<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?

Author Comment

ID: 35457157
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.
LVL 39

Expert Comment

ID: 35457178

> 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.


Author Comment

ID: 35457182
good idea

let me get back to you on that

Author Comment

ID: 35469382

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.


Author Closing Comment

ID: 35469388
great advice


Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question