Can anyone see anything wrong with this code? I am trying to loop through
data to find the Sales Persons login id and for each sales person return the
activities, dates, contacts, etc. for them to see. The error is listed
below.
 
There are two pages to this.
 
The first page goes out and retrieves the all login ids and then sends that
info to the second page as an attribute. 
 
Here is the code on the first page:
----------------------------------------------------------------------------
-------------------------------------------------
<cfquery name="q_email" datasource="ecms">
 
SELECT      email_, logname, sls_psn_code
FROM         dbo.gmslspsn 
WHERE       job_code = 'SALES'
 
</cfquery>
 
<cfoutput query="q_email"><cf_Act_Schedule
 sls_psn_code='#q_email.sls_psn_code#'></cfoutput>
----------------------------------------------------------------------------
---------------------------------------------------
Here is the code for the second page:
 
<cfquery name="q_act_detail" datasource="ecms">
 
SELECT act_key, CONVERT(char(10), date_, 101) AS ACT_DATE, 
time_, 
act_code, 
result_code, 
act_txt, 
duration_, 
result_code, 
gmin_mngr.recordid, 
contact_fname, 
contact_lname, 
company_name_1,
comp_phone, 
gmopph.description,
address1,
city,
state,
zip 
FROM gmin_mngr LEFT JOIN gminfo ON gmin_mngr.recordid = gminfo.recordid LEFT
JOIN gmcmpany ON gmin_mngr.comp_code=gmcmpany.comp_code LEFT JOIN gmopph ON
gmin_mngr.opp_code = gmopph.opp_code 
LEFT JOIN gmcm_addr ON gmcmpany.comp_code = gmcm_addr.comp_code
WHERE sls_psn_code = '#attributes.sls_psn_code#' 
AND date_ BETWEEN '#DateFormat(Now(), "MM/DD/YYYY")#' AND
'#DateFormat(DateAdd("d",7,Now()), "MM/DD/YYYY")#' AND result_code = '' 
ORDER BY date_, time_
 
</cfquery>
 
 
 

<cfif q_act_detail.recordcount gt 0>
 
<cfoutput query="q_act_detail">
 
<cfset name = Trim(contact_fname) & ' ' & contact_lname>
 
<cfset aSales = ArrayNew(1)>
 
<cfset temp = ArraySet(aSales, 1, q_act_detail.currentrow, StructNew())>
 
 
 
<!--- Create a structure as the first array element --->
 
<cfset aSales[#q_act_detail.currentrow#] = StructNew()>
<cfset aSales[#q_act_detail.currentrow#].Sales_Psn =
"#attributes.sls_psn_code#">
<cfset aSales[#q_act_detail.currentrow#].Date = "#act_date#">
<cfset aSales[#q_act_detail.currentrow#].Contact_Name = "#name#">
<cfset aSales[#q_act_detail.currentrow#].Act_Code = "#act_code#">
<cfset aSales[#q_act_detail.currentrow#].Comp_Name = "#company_name_1#">
<cfset aSales[#q_act_detail.currentrow#].Comp_Phone = "#comp_phone#">
<cfset aSales[#q_act_detail.currentrow#].Address1 = "#address1#">
<cfset aSales[#q_act_detail.currentrow#].City = "#city#">
<cfset aSales[#q_act_detail.currentrow#].State = "#state#">
<cfset aSales[#q_act_detail.currentrow#].Zip = "#zip#">
 
</cfoutput>
<!--- <cfmail query="q_act_detail" to="whoever" from="admin"
subject="#attributes.sls_psn_code#" type="HTML">
 
<cfoutput><b>#ACT_DATE#</b>
<br>
<cfset name = Trim(contact_fname) & ' ' & contact_lname>#act_code#
#company_name_1# <cfif len(TRIM(comp_phone)) eq
7>#LEFT(TRIM(comp_phone),3)#&ndash;#RIGHT(comp_phone,4)#<cfelse>(#LEFT(TRIM(
comp_phone),3)#)#LEFT(RIGHT(TRIM(comp_phone),7),3)#-#RIGHT(TRIM(comp_phone),
4)#</cfif><br>
#Trim(address1)# #Trim(city)#, #Trim(state)# #Trim(zip)#<br>
#name#<br></cfoutput>
 
 
 
</cfmail>
 --->
<cfloop index="i" from="1" to="#ArrayLen(aSales)#">
 
<cfoutput>
 
<strong>#aSales[i].Sales_Psn#</strong><br>
#aSales[i].Date#<br>
<strong>#aSales[i].Act_Code#</strong> #aSales[i].Contact_Name#<br>
#aSales[i].Comp_Name#<br>
<cfif len(TRIM(aSales[i].comp_phone)) eq
7>#LEFT(TRIM(aSales[i].comp_phone),3)#&ndash;#RIGHT(aSales[i].comp_phone,4)#
<cfelse>(#LEFT(TRIM(aSales[i].comp_phone),3)#)#LEFT(RIGHT(TRIM(aSales[i].com
p_phone),7),3)#-#RIGHT(TRIM(aSales[i].comp_phone),4)#</cfif><br>
#Trim(aSales[i].address1)#<br> #Trim(aSales[i].city)#,
#Trim(aSales[i].state)# #Trim(aSales[i].zip)#<br>
 
</cfoutput>
 
</cfloop>
 
</cfif>
----------------------------------------------------------------------------
---------------------------------------
This is the error I get:
 

Error Diagnostic Information



An error occurred while evaluating the expression: 



#aSales[i].Sales_Psn#



Error near line 75, column 19. 
  _____  


The member "SALES_PSN" in dimension 1 of object "aSales" cannot be found.
That struct object is empty. 



The error occurred while processing an element with a general identifier of
(#aSales[i].Sales_Psn#), occupying document position (75:9) to (75:29) in
the template file E:\INETPUB\EIC\MAINTENANCE\ACT_SCHEDULE.cfm.


Date/Time: 04/03/02 16:24:14
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Remote Address: 10.16.128.83


______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to