Hi -
I want to loop over a query and Get users with hours charged to a project. When this runs it just shows the total of all the hours for each person. This query should return 2 people one with 12 hours and the other with four. instead it shows both with 16?
This has to be something right in front of me... Any help will be greatly appreciated - Thank you.
<CFQUERY datasource="DataSource" name="Chart_Hours">
SELECT URS.First, URS.Last, URS.User_ID, PHO.Edition_ID,
PHO.date_entered, PHO.User_ID, PHO.Date_Time, PHO.Project, PHO.Hours, PHO.Billed,
PRO.PROJECT_NAME, PRO.PROJECT_ID
FROM Users URS, Project_Hours PHO, PROJECTS PRO
WHERE URS.User_ID = PHO.User_ID
AND PHO.Project = 160
AND PRO.Project_ID = 160
</CFQUERY>
<CFSET counter = 0>
<cfloop index="i" from="1" to="#PROJECT_HOURS.RecordCount#">
<CFSCRIPT>
counter = counter + #PROJECT_HOURS.Hours#;
</CFSCRIPT>
</cfloop>
<cfchart format="png" scalefrom="0" SHOW3D="YES" scaleto="#PROJECT_HOURS.RECORDCOUNT#" SHOWLEGEND="YES" TITLE="#PROJECT_HOURS.Project_Name#">
<cfchartseries type="bar" serieslabel="Website Traffic 2006" seriescolor="blue">
<CFOUTPUT QUERY="PROJECT_HOURS">
<cfchartdata item="#PROJECT_HOURS.USERFIRST# #PROJECT_HOURS.USERLAST#" value="#counter#">
</CFOUTPUT>
</cfchartseries>
</cfchart>
I want to loop over a query and Get users with hours charged to a project. When this runs it just shows the total of all the hours for each person. This query should return 2 people one with 12 hours and the other with four. instead it shows both with 16?
This has to be something right in front of me... Any help will be greatly appreciated - Thank you.
<CFQUERY datasource="DataSource" name="Chart_Hours">
SELECT URS.First, URS.Last, URS.User_ID, PHO.Edition_ID,
PHO.date_entered, PHO.User_ID, PHO.Date_Time, PHO.Project, PHO.Hours, PHO.Billed,
PRO.PROJECT_NAME, PRO.PROJECT_ID
FROM Users URS, Project_Hours PHO, PROJECTS PRO
WHERE URS.User_ID = PHO.User_ID
AND PHO.Project = 160
AND PRO.Project_ID = 160
</CFQUERY>
<CFSET counter = 0>
<cfloop index="i" from="1" to="#PROJECT_HOURS.RecordCount#">
<CFSCRIPT>
counter = counter + #PROJECT_HOURS.Hours#;
</CFSCRIPT>
</cfloop>
<cfchart format="png" scalefrom="0" SHOW3D="YES" scaleto="#PROJECT_HOURS.RECORDCOUNT#" SHOWLEGEND="YES" TITLE="#PROJECT_HOURS.Project_Name#">
<cfchartseries type="bar" serieslabel="Website Traffic 2006" seriescolor="blue">
<CFOUTPUT QUERY="PROJECT_HOURS">
<cfchartdata item="#PROJECT_HOURS.USERFIRST# #PROJECT_HOURS.USERLAST#" value="#counter#">
</CFOUTPUT>
</cfchartseries>
</cfchart>