Solved

CFTHREAD

Posted on 2010-11-15
4
504 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
Comment Utility
0
 
LVL 24

Accepted Solution

by:
dgrafx earned 500 total points
Comment Utility
<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
Comment Utility
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 24

Expert Comment

by:dgrafx
Comment Utility
glad it helped ...
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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 …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

16 Experts available now in Live!

Get 1:1 Help Now