[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.8

Using <cfinclude template=" ... "> and problems generating a SwiffChart within page!

Asked by rcbuchanan in ColdFusion Application Server

Tags: cfinclude

Ok, for some reason (and I'm beyond newbie /w CF) I just cannot figure out what I'm doing wrong.
I have web page in cf that is supposed to query a table and create a SwiffChart in Flash to then be displayed.

The problem - process_opinion_linechart.cfm - refuses to create the flash chart. ... It returns this message :

'http://www.fred.com/charts/0015720040827.swfhttp://www.fred.com/charts/0015720040827.swf 100100758573716361333055150157157157157'

BUT IF i run the process_opinion_linechart.cfm DIRECTLY ... (calling it via browser) ... then it runs just fine!
What the heck am I doing wrong!?


page - called <page_viewopinion.cfm>
---------------------------------------------

This page has some tables and general html crap ... for layout etc.
I have these two items:

<cfinclude template="process_opinion_linechart.cfm">
<cfinclude template="template_opiniontimeline.cfm">

and the page ends with other crap like a footer etc.


process_opinion_linechart.cfm
-----------------------------------

This code creates my SwiffChart flash chart file UNLESS it already exists.

<cfset string_opid = #numberformat(url.op,"00000")#>
<cfset string_date = #dateformat(now(),"yyyymmdd")#>
<cfset swfFilename = #string_opid# & #string_date# & ".swf">
<CFSET dirpath = "c:\web\fred\dev\htdocs\charts\">

<cfif fileexists(#dirpath# & #swfFilename#) eq 'yes'>
<cfelse>

<!--- Sets the filename of the style.  This assumes that the style is in the same directory as this script --->
<cfset chartStyle = "newline460.scs">

<!--- Load Opinion Data --->
<cfquery name="loadData" datasource="fred">
select opinionvotes.vote_date, sum(opinionvotes.vote_want_yes) as want_yes, sum(opinionvotes.vote_want_no) as want_no, sum(opinionvotes.vote_agree_yes) as agree_yes, sum(opinionvotes.vote_agree_no) as agree_no from opinionvotes where opinionvotes.opinion_id=#url.op# group by opinionvotes.vote_date order by opinionvotes.vote_date
</cfquery>       
        
<!--- Don't have to touch this --->
<CFSETTING ENABLECFOUTPUTONLY="Yes" SHOWDEBUGOUTPUT="No">

<CFOBJECT TYPE="COM"
        NAME="chart"
        CLASS="SwiffChartObject.ChartObj.1"
        ACTION="CREATE">

<!--- Define seperators rules. Don't have to touch this --->
<CFSET sep= ";">
<CFSET ignoremultseparators= true>
<CFSET chart.SetSeparators(sep, ignoremultseparators)>

<cfset agree_total_yes = 0><cfset agree_total_no = 0>
<cfset want_total_yes = 0><cfset want_total_no = 0>
<cfset agree_string = ''><cfset want_string = ''>
<cfset myCategories = ''>
<cfset pointer = 0>
<cfloop query="loadData">

<!--- Create a string for each series --->
<CFSET myCategories= myCategories & "#dateformat(loadData.vote_date,'mm/dd')#" & sep>

<cfset agree_total_yes = agree_total_yes + #loadData.agree_yes#>
<cfset agree_total_no = agree_total_no + #loadData.agree_no#>
<cfset want_total_yes = want_total_yes + #loadData.want_yes#>
<cfset want_total_no = want_total_no + #loadData.want_no#>

<!--- Create a string for each series --->
<cfset agree_percent = #round(agree_total_yes / (agree_total_yes + agree_total_no) * 100)#>
<cfset want_percent = #round(want_total_yes / (want_total_yes + want_total_no) * 100)#>
<cfset agree_string = agree_string & "#agree_percent#" & sep>
<cfset want_string = want_string & "#want_percent#" & sep>
</cfloop>
 
<!--- Fill the chart with the series --->
<CFSET chart.SetCategoriesFromString(myCategories)>
<CFSET chart.AddSeries()>
<CFSET chart.SetSeriesValuesFromString(0, agree_string)>
<CFSET chart.AddSeries()>
<CFSET chart.SetSeriesValuesFromString(1, want_string)>
<CFSET style = dirpath & chartStyle>
<CFSET chart.LoadStyle( style )>

<!--- Set the dimensions of the movie.  IF YOU CHANGE THIS, YOU NEED TO CHANGE THE SIZE BELOW TO REFLECT THIS! --->
<CFSET chart.SetWidth( 460 )>
<CFSET chart.SetHeight( 200 )>

<!--- This just sets where the graph gets generated --->
<CFSET account_id = "100">
<CFSET filename = dirpath & swfFilename>
<CFSET chart.ExportAsFile(filename)>
<cfset chartInfo.filename = swfFilename>
</cfif>



template_opiniontimeline.cfm
----------------------------------

This page is supposed to display the bloody swiff chart but never gets this far!!!!!!!!!!!
UNLESS the swiff chart alread EXISTS (has been created!) and this it displays it just fine.

<cfset string_opid = numberformat(url.op,"00000")>
<cfset string_date = dateformat(now(),"yyyymmdd")>
<cfset swfFilename = string_opid & string_date & ".swf">
<cfset dirpath = "c:\web\fred\dev\htdocs\charts\">
<cfset lookupFilename = dirpath & swfFilename>

<cfscript>
tStop=DateAdd('s',20,now());
o_file = CreateObject('java','java.io.File').init(lookupFilename);
thread = CreateObject("java", "java.lang.Thread");
fileFound = false;
while(DateCompare(now(),tStop) lt 0) {
     if(o_file.exists() AND o_file.length() gt 0) {
          fileFound = true;
          break;
     }
     else thread.sleep(1000);
}
</cfscript>
<cfif fileFound>
found found found found [placed to test the code]
<cfset string_opid = #numberformat(url.op,"00000")#>
<cfset string_date = #dateformat(now(),"yyyymmdd")#>
<cfset swfFilename = "http://www.fred.com/charts/" & #string_opid# & #string_date# & ".swf">

<table width="460" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="460" colspan="1"><img name="label_hottopics" src="/newopex_graphics/label_opiniontimeline460x30.jpg" width="460" height="30" alt="" border="0"></td>
  </tr>
  <tr>
        <td width="460" height="200">
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="460" height="200">
        <param name="movie" value="<cfoutput>#swfFilename#</cfoutput>">
        <param name="quality" value="high">
        <embed src="<cfoutput>#swfFilename#</cfoutput>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="460" height="200"></embed>
      </object>
      </td>
  </tr>
</table>
<cfelse>
not found not found not found    [i placed to test the code ...]
</cfif>





What gives!? I just don't get what I'm doing wrong!
For some reason the <cfinclude template="process_opinion_linechart.cfm"> does not finish!

DRIVING ME NUTS!
Any ideas?

Richard
[+][-]08/31/04 09:14 AM, ID: 11943692Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: ColdFusion Application Server
Tags: cfinclude
Sign Up Now!
Solution Provided By: rcbuchanan
Participating Experts: 2
Solution Grade: B
 
[+][-]08/27/04 01:59 PM, ID: 11917599Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/27/04 02:02 PM, ID: 11917624Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/27/04 02:06 PM, ID: 11917668Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/27/04 08:51 PM, ID: 11919262Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/28/04 07:10 AM, ID: 11921203Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/28/04 08:38 AM, ID: 11921594Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/31/04 08:27 AM, ID: 11943133Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/31/04 08:43 AM, ID: 11943333Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/31/04 08:44 AM, ID: 11943359Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/31/04 03:01 PM, ID: 11947164Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09/05/04 02:17 AM, ID: 11983517Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92