Solved

CFTHREAD

Posted on 2010-11-15
4
506 Views
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#">
    select…
  </cfquery>

  <cfquery name="getqaecounts" datasource="#dev#">
    select…
  </cfquery>

</cfthread>

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,

Eric
0
Comment
Question by:ehart12
  • 2
4 Comments
 
LVL 19

Expert Comment

by:Bhavesh Shah
ID: 34143932
0
 
LVL 25

Accepted Solution

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

#go1.output#

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#">
0
 

Author Comment

by:ehart12
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,

Eric
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 34303634
glad it helped ...
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ColdFusion Web Service/WSDL Connection Issue 2 88
Database structure 4 131
CFMail not sending messages with queries 5 45
Using a variable with dateAdd 18 66
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

932 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now