Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Error with dynamic variable

Posted on 2003-10-28
2
Medium Priority
?
145 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 800 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

926 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