Solved

Error with dynamic variable

Posted on 2003-10-28
2
138 Views
Last Modified: 2013-12-24
<CFOUTPUT query="q_ProjectNumbers">
  <CFSET 'TotalProject_#ProjectNumber#' = 0>
</CFOUTPUT>

<CFOUTPUT query="q_employeeNames"><CFSET TotalBillable = 0>
              <tr>
                <td>#q_employeeNames.employeeName#</td>
                 <CFLOOP list="#plist#" index="pid">
                       <CFQUERY name="q_ProjectsWorkedOn" datasource="MMIAppDB">
                        SELECT sum(BillableHours) AS Billable, ProjectNumber, EmployeeName
                        FROM Timesheet
                        WHERE EmployeeName = '#q_employeeNames.EmployeeName#' AND ProjectNumber = '#pid#' AND Date BETWEEN #createODBCdate(DateRange.Start)# AND #createODBCdate(DateRange.End)#
                        GROUP BY ProjectNumber, EmployeeName
                       </CFQUERY>
                       <td><CFIF q_projectsWorkedOn.billable is "">&nbsp;<CFELSE>#q_projectsWorkedOn.billable# <CFSET TotalBillable = (TotalBillable + q_projectsWorkedOn.billable)><CFSET 'TotalProject_#pid#' = 'TotalProject_#pid#' + q_projectsWorkedOn.billable></CFIF></td>
                 </CFLOOP>
              <td>#TotalBillable# <CFSET TotalTotal = (TotalTotal + TotalBillable)><td></tr>
            </CFOUTPUT>

Error:


The value "TotalProject_445" cannot be converted to a number  

The Error Occurred in C:\Inetpub\wwwroot\resourceadmin\viewtimesheet.cfm: line 68
 
66 :                         GROUP BY ProjectNumber, EmployeeName
67 :                        </CFQUERY>
68 :                        <td><CFIF q_projectsWorkedOn.billable is "">&nbsp;<CFELSE>#q_projectsWorkedOn.billable# <CFSET TotalBillable = (TotalBillable + q_projectsWorkedOn.billable)><CFSET 'TotalProject_#pid#' = 'TotalProject_#pid#' + q_projectsWorkedOn.billable></CFIF></td>
69 :                  </CFLOOP>
70 :               <td>#TotalBillable# <CFSET TotalTotal = (TotalTotal + TotalBillable)><td></tr>

 
0
Comment
Question by:Max_Davis
2 Comments
 
LVL 15

Accepted Solution

by:
danrosenthal earned 200 total points
ID: 9638205
looks like the error is with this line:
<CFSET 'TotalProject_#pid#' = 'TotalProject_#pid#' + q_projectsWorkedOn.billable>

change it to this:
<CFSET 'TotalProject_#pid#' = evaluate('TotalProject_'&pid) + q_projectsWorkedOn.billable>
0
 

Author Comment

by:Max_Davis
ID: 9638269
Thank you
0

Featured Post

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

863 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

27 Experts available now in Live!

Get 1:1 Help Now