Posted on 2010-11-15
Last Modified: 2012-05-10
Hi Experts,

I have two <cfoutput queries> that groups a large amount of data  and takes about 2-5 seconds to execute.  I would like to use <cfthread> to run these at the same time, however I am unsure of the exact format required.

My current test code is;

<cfthread action="run" name="go1">
  <cfquery name="getqaecounts" datasource="#dev#">

  <cfquery name="getqaecounts" datasource="#dev#">


When I run the above code, the queryies do not display anything.  When I run the above code without the <CFTHREAD>, the results are displayed.

Thank you,

Question by:ehart12
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 19

Expert Comment

by:Bhavesh Shah
ID: 34143932
LVL 25

Accepted Solution

dgrafx earned 500 total points
ID: 34145098
<cfthread action="run" name="go1" priority="low">
<cfquery name="getqaecounts1" datasource="#dev#">
select somvar, someothervar
<cfoutput query="getqaecounts1">
#somevar# - #someothervar#<br>
<cfquery name="getqaecounts2" datasource="#dev#">
select somvar, someothervar
<cfoutput query="getqaecounts2">
#somevar# - #someothervar#<br>
<cfthread action="join" timeout="10000" />


in the cfthread block above (notice the priority=low) just code your queries and your output loops
then you join the thread with the current page
the go1.output will be the html output generated
you can also cfset vars within the cfthread
like you can put <cfset go1.getqaecounts2=getqaecounts2> within the cfthread
then after joining the thread you can do <cfdump var="#go1.getqaecounts1#">

Author Comment

ID: 34175128
Hi dgrafx,

Thank you for the sample code.  I will give this a try and get back to you in the next few weeks with any questions.

Have a great day,

LVL 25

Expert Comment

ID: 34303634
glad it helped ...

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 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