Solved

Error with dynamic variable

Posted on 2003-10-28
2
140 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 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