[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

First Solo Application Not displaying properly

Hello,
  Alright, this is my first solo Coldfusion application and I am having trouble with the output.  I guess I am not placing the <CFOUTPUT> tags in the proper location.  I've gone through all of my queries and they are running properly in the query analyzer but when I run this report nothing happens ( I have attached the output).  I've worked on existing applications but this is the first time that I had to develop one from the ground up so it's probably something simple that I am missing.  Thanks in advance for any assistance with this.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 
<html>
<head>
	<title>Open House Goals</title>
</head>
 
<body leftmargin="0" marginheight="0" marginwidth="0" bottommargin="0" rightmargin="0" topmargin="0"
alink="993399" link="993399" vlink="black">
 
 
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	
<tr><td>
<table align="center">
		
	<tr><!---  <form action="weekly_monthly_sales_report_1.cfm" method="post" name="SalesReport"><td align="left" colspan="6">Select the month/year:
		<cfset beginYear = '2008'>
			<cfset thisDate = #CreateODBCDate(now())#>
			<cfset thisMonth = #DateFormat(thisDate, 'mm')#>
			<cfset thisYear = #DateFormat(thisDate, 'yyyy')#> 
			<cfoutput>				
		
			<select name="search_month">
				<option selected >#DateFormat(thisDate, 'mmmm')#
				<option value="">-----
				<cfloop from="12" to="1" index="numMon" step="-1">
					<cfset optionMonth = '#numMon#/01/2008'>
					<option value="#DateFormat(optionMonth, 'mm')#">#DateFormat(optionMonth, 'mmmm')#
				</cfloop>
			</select>
			<select name="search_year">
			<option selected>#DateFormat(thisDate, 'yyyy')#
			<option value="">-----
			<cfloop from="#thisYear#" to="#beginYear#" index="selectYear" step="-1">
				<option value="#selectYear#">#selectYear#
			</cfloop>
			</select>
			
			<input type="submit" name="submit" value="Report">
 
			</cfoutput> 
			</td>
		</form> 
 	<cfif parameterExists(form.submit)> 
	<cfset date_var = '#search_month#/01/#search_year#'> 
	<cfelse>
	<cfset date_var = '#dateformat(now(), 'mm')#/01/#dateformat(now(), 'yyyy')#'>
	</cfif> --->
 
	<!--- <cfoutput>#date_var#</cfoutput> --->
 
	<!---<form action="open_house_goals.cfm" method="post" name="excelReport">
	<td align="right" colspan="2"><input type="submit" name="Excel" value="Report in Excel" />--->
	<!--- <input type="hidden" name="search_month" value="#form.search_month#">
	<input type="hidden" name="search_year" value="#form.search_year#"> --->
	</td>
	</form>
	</tr>
			<!--- report in excel spreadsheet --->
<!--- <cfif parameterExists(Excel)> --->
	<cfheader name="Content-Disposition" value="attachment;filename=openhouse.xls">
	
	<cfheader name="cache-control" value="cache">
	
	<cfcontent type="application/msexcel"> 
<!--- </cfif> --->
<!--- vnd.ms-excel --->
		<cfset date_var='#form.search_month#/01/#form.search_year#'>
	<tr><td align="center" colspan="20"><h3>Open House Goals
	<cfoutput>#DateFormat(date_var, 'mmmm')#, #DateFormat(date_var, 'yyyy')#</cfoutput></h3></td></tr> 
	
	<cfset nmbr_to_add = (8-(DayOfWeek(date_var))) MOD 7>
	<!---<cfset nmbr_to_add = 8-(DayOfWeek(date_var) MOD 7)>--->
	
<!--- 	 <cfoutput>Number to add to #date_var# to get to Sunday is: #nmbr_to_add#</cfoutput> --->
 
	<cfset wkend='#dateformat(dateAdd('d', nmbr_to_add, date_var), 'mm/dd/yy')#'>
	<!--- get number of weekends for this month --->
	<cfset count= 0>
	<cfloop index="countwks" from=0 to=5 step=1>
		 <cfif dateformat(wkend, 'm') is dateformat(date_var, 'm')> 
		<cfset count= count +1>
		</cfif> 
		<cfset wkend = '#dateformat(dateAdd('d', '7', wkend), 'mm/dd/yy')#'>
	</cfloop>  
		
	<!---  <cfoutput>#count#</cfoutput>  --->
<table width="350" align="center" border="1">
	
	<tr><td>&nbsp;</td>
	<cfset wkenddate ='#dateformat(dateAdd('d', nmbr_to_add, date_var), 'mm/dd/yy')#'>
	
	<cfloop index="wkenddates" from=1 to="#count#" step=1>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
 
	<td colspan="2" align="center" ><cfoutput><b>#wkenddate#</b></cfoutput></td>
	<cfset wkenddate = '#dateformat(dateAdd('d', '7', wkenddate), 'mm/dd/yy')#'>
	
	</cfloop>
	<!---Next row with column names--->
<tr> <td align="center" colspan="1"><b>Office</b></td>
<!---Get and display current month and oh goal and week ending headers --->
<!---monthly license count--->
	<td align="center" colspan="1"> <cfoutput><b>#DateFormat (date_var, 'mmmm')#, Licenses</b></cfoutput></td>
<!---Open house goal--->
	<td align="center" colspan="1"><b>OH Goal</b></td>
<!---weekly totals column names--->
	<cfloop index="num" from="1" to="#count#">
	<td align="center" colspan="1"><b># of OH</b></td>
    <td align="center" colspan="1"><b>Over/Under Goal</b></td>
    </cfloop> 
<!---Month to date columns--->
    <td align="center" colspan="1"><b># of OH</b></td>
    <td align="center" colspan="1"><b>Total Licenses</b></td>
    <td align="center" colspan="1"><b>Over/Under Goal</b></td>
    
    </tr>
<!---queries and output begin here--->
	<cfset mywkend='#dateformat(dateAdd('d', nmbr_to_add, date_var), 'mm/dd/yy')#'>
 
	<cfquery name="getOffice" datasource="reo">
    SELECT		distinct(office_ID)
    FROM		sales_volume
    ORDER BY	office_ID
    </cfquery>
    
    <cfoutput query="getoffice">
	<tr>
		 <td align="center"><b>#getoffice.office_ID#</b></td> 
        
      
    <cfquery name="getWkEnding" datasource="reo">
    SELECT		*
    FROM		sales_volume
    WHERE		week_ending = '#mywkend#'
    AND			office_ID='#getoffice.office_ID#'
    </cfquery>
    </cfoutput>
    <cfloop index="wkends" from="1" to="#count#" step ="1">  
    <cfoutput query="getWkEnding">
    	<tr  ><td align="center"><b>#getWkEnding.LicenseCount#</b></td>
        </cfoutput>
        </cfloop>
        
   <cfquery name="getCalcOHGoal" datasource="reo">
   UPDATE 		sales_volume
   SET 			sales_volume.oh_goal= [LicenseCount] * .25
   WHERE		week_ending='#mywkend#'   
   </cfquery>
   <cfquery name="getOHGoal" datasource="reo">
   SELECT	oh_goal
   FROM		sales_volume
   WHERE	week_ending='#mywkend#'
   </cfquery>
   
   
 <cfoutput>
   		<tr  ><td align="center"><b>#getOHGoal.oh_goal#</b></td>
        
        
   <cfquery name="getcalcOUGoal" datasource="reo">
   UPDATE		sales_volume
   SET			ou_goal= [openhouses]-[oh_goal]
   WHERE		week_ending='#mywkend#'
   </cfquery>
   <cfquery name="getOUGoal" datasource="reo">
   SELECT	ou_goal
   FROM		sales_volume
   WHERE	week_ending='#mywkend#'
   </cfquery>
   
    
<!---alternate color of week ending columns and display data for week ending columns (also inlclues code to display in red any ou_goal that is less than oh_goal--->
    
	<cfif #wkends# MOD '2' NEQ '0'><cfset col="FFFFA6"><cfelse> <cfset col="White"></cfif>
    <td align="center" bgcolor="#col#">#getWKEnding.openhouses#</td>
    <td align="center" bgcolor="#col#">#getOUGoal.ou_goal#</td>
 
<!---All company totals for weekending are displayed here--->
	<cfset Total_OH = 0>
    <cfset LicenseCount =0>
    <cfset Total_OUGoal = 0>
    
 
 	<cfif getWKEnding.openhouses NEQ ''><cfset total_OH = total_OH + '#getWKEnding.openhouses#'></cfif>
    
    <cfif getOUGoal.ou_goal NEQ ''><cfset total_OUGoal = total_OUGoal + '#getOUGoal.ou_goal#'></cfif>
    </cfoutput>
 
   
	<cfoutput>
    <tr  ><td align="center">#NumberFormat(Total_OH)#</td>
    <td align="center">#NumberFormat(LicenseCount)#</td>
    <td align="center">#NumberFormat(Total_OUGoal)#</td>
    </cfoutput>
    
    
<!---All office MTD Totals--->
<cfset totalAllMTD_OH = 0>
<cfset totalAllMTD_Licenses = 0>
<cfset totalAllMTD_OUGoal = 0>
 
<cfset totalAllMTD_OH = totalAllMTD_OH + #Total_OH#>
<cfset TotalMTD_Licenses = totalALLMTD_Licenses  + #LicenseCount#>
<cfset TotalALLMTD_OUGoal = totalAllMTD_OUGoal + #Total_OUGoal#>
<!---Detroit Offices--->
 
<!---<cfif (office_ID NEQ '63' AND office_ID NEQ '64' AND office_ID NEQ '65' AND office_ID NEQ '67' AND office_ID NEQ '68' AND office_ID NEQ '69')>--->
<cfif listFindNoCase("63,64,65,67,68,69", getOffice.office_ID ) neq 0>
<cfset totalDETMTD_OH = 0>
<cfset totalDETMTD_Licenses = 0>
<cfset totalDETMTD_OUGoal = 0>
 
 
<cfset totalDETMTD_OH = totalDETMTD_OH + #Total_OH#>
<cfset TotalDETMTD_Licenses = totalDETMTD_Licenses + #License_count#>
<cfset TotalDETMTD_OUGoal = totalDETMTD_OUGoal + #Total_OUGoal#>
</cfif>
 
 
	<tr><td><b>Metro Detroit Total</b></td>
<!---Gets license and oh_goal then get weekly totals for Detroit offices--->
<cfset mywkend='#dateformat(dateAdd('d', nmbr_to_add, date_var), 'mm/dd/yy')#'>
	<cfquery name="getDetLicenses" datasource="reo">
    SELECT		SUM (LicenseCount) AS 'totalDetLicenseCount',
    			SUM (OH_Goal) AS 'totalDetOHGoal'
    FROM		sales_volume
    WHERE		week_ending='#mywkend#'
    AND			(office_ID <> 63 AND office_ID <> 64 AND office_ID <> 65 AND office_ID <> 67 AND office_ID <> 68 AND office_ID <> 69)
    </cfquery>
    <cfoutput>
    <td align="center"><b>#NumberFormat(getDetLicenses.totalDetLicenseCount)#</b></td>
   <td align="center"><b>#NumberFormat(getDetLicenses.totalDetOHGoal)#</b></td>
    </cfoutput>
 
<cfloop index="wkends" from=1 to="#count#" step=1>
 
	<cfquery name="getDetTotals" datasource="reo">
    SELECT		SUM(openhouses) as totalDetOH,
                SUM(OU_Goal) as totalDetOU_Goal
    FROM		sales_volume
    WHERE		week_ending = '#mywkend#'
    AND			(office_ID <> 63 AND office_ID <> 64 AND office_ID <> 65 AND office_ID <> 67 AND office_ID <> 68 AND office_ID <> 69)
    </cfquery>
    
 <cfoutput>
 	<td align="center"><b>#NumberFormat(getDetTotals.totalDetOH)#</b></td>
    <td align="center"><b>#NumberFormat(getDetTotals.totalDetOU_Goal)#</b></td>
    
<cfset mywkend = '#dateformat(dateAdd('d', '7', mywkend), 'mm/dd/yy')#'>
    
</cfoutput>
 
</cfloop>
<!---Output for MTD Detroit Offices--->
	<td align="center"><b>#NumberFormat(totalDetMTD_OH)#</b></td>
    <td align="center"><b>#NumberFormat(totalDETMTD_Licenses)#</b></td>
    <td align="center"><b>#NumberFormat(totalDETMTD_OUGoal)#</b></td>
 
</tr>
 
<!---Get and display Licens and OH goal for all offices and weekending numbers for all offices--->
<tr><td><b>All Company Total</b></td>
<cfset mywkend='#dateformat(dateAdd('d', nmbr_to_add, date_var), 'mm/dd/yy')#'>
 
 
<cfquery name="getLicenseTotals" datasource="reo">
SELECT		SUM(LicenseCount) as totalLicenses,
			SUM(OH_Goal) as totalOHGoal
FROM		sales_volume
WHERE		week_ending ='#mywkend#'
</cfquery>
<cfloop index="wkends" from=1 to="#count#" step=1>
<cfoutput>
	<td align="center"><b>#NumberFormat(getLicenseTotals.totalLicenses)#</b></td>
    <td align="center"><b>#NumberFormat(getLicenseTotals.totalOHGoal)#</b></td>
    </cfoutput>
    </cfloop>
    
    
    <cfquery name="getTotals" datasource="reo">
    SELECT		SUM(openhouses) as totalOH,
    			SUM(OU_goal) as totalOU_Goal
    FROM		sales_volume
    WHERE		week_ending ='#mywkend#'
    </cfquery>
    <cfloop index="wkends" from="1" to="#count#" step="1">
    <cfoutput>
    <td align="center"><b>#NumberFormat(getTotals.totalOH)#</b></td>
    <td align="center"><b>#NumberFormat(getTotals.totalOU_Goal)#</b>
    
    <cfset mywkend = '#dateformat(dateAdd('d', '7', mywkend), 'mm/dd/yy')#'>
    </cfoutput>
    </cfloop>
    
    <!---Output total MTD for all offices--->
    <cfoutput>
    	<td align="center"><b>#NumberFormat(totalAllMTD_OH)#</b></td>
    	<td align="center"><b>#NumberFormat(totalAllMTD_Licenses)#</b></td>
    	<td align="center"><b>#NumberFormat(totalALLMTD_OUGoal)#</b></td></cfoutput>
        </tr>
        </table>
        
    
 
 
 
        
	 
</body>
</html>

Open in new window

example-.xls.htm
0
jdines
Asked:
jdines
  • 5
  • 2
1 Solution
 
Gurpreet Singh RandhawaWeb DeveloperCommented:
can u tell what error you are getting. might help in resolving the error by viewing its error details
0
 
jdinesAuthor Commented:
That's just it I'm not getting any errors at all.  The report just comes up without displaying the data, which is why I thought that the output tags that were misplaced.  Prior to this I was receiving errors, but I resolved all of those and the attached excel file is what came of it.  Sorry I don't have any more information, as long as there were errors it was pretty simple to resolve.
0
 
SidFishesCommented:
without seeing code, it's almost impossible to help however, cffile will create a file without outputting anything to the browser. This is normal.

0
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 
jdinesAuthor Commented:
I attached the code above, if you could take a look it would be greatly appreciated.  Thank you!
0
 
Gurpreet Singh RandhawaWeb DeveloperCommented:
Make a cfdump after each query and before the cffile tag to see where you are not getting results, this will help you in identifyting the issue where the problem lies exactly so if there is any cf error then we will be able to help yu

Regards
0
 
jdinesAuthor Commented:
Hello,
  I added the cfdump tags and I have attached the results.  All of the queries ran properly but the data is still not displaying in the proper column.
0
 
jdinesAuthor Commented:
oops here's the attachment, I had to remove some of the figures before posting, but all of them were there and were correct.
results-.xls.htm
0
 
jdinesAuthor Commented:
I resolved the output issue...thanks to all of those who left comments
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now