Hello,

I have a text file called field_offices.txt which contains information like this:

6BPH, [EMAIL PROTECTED], Albuquerque;
4APH, [EMAIL PROTECTED], Atlanta;
3BPH, [EMAIL PROTECTED], Baltimore;
4CPH, [EMAIL PROTECTED], Birmingham;

The meaning is:
FOCode, FOEmail, FOName

I need to read this text file and use it to populate a drop down menu showing FOName 
and sending to the next page all three values FOCode, FOEmail and FOName as separate 
variables.

My code is as follows:

<cfoutput>
<cfset CURRENTDIRECTORY = #GETDIRECTORYFROMPATH(GETTEMPLATEPATH())#>
<cffile ACTION="Read" FILE="#CURRENTDIRECTORY#field_offices.txt" 
VARIABLE="fieldoffice">
<cfset fieldofficelist=ListToArray(fieldoffice,";")>
<cfloop index="idxLine" from=1 to=#ArrayLen(fieldofficelist)# step=1>
<cfset strFO = #trim(fieldofficelist[idxLine])#>
<cfset strFOCode = #trim(listGetAt(strFO,1))#>
<cfset strFOEmail = #trim(listGetAt(strFO,2))#>
<cfset strFOName = #trim(listGetAt(strFO,3))#>          
Index = #idxLine# |
Field Office Code = #strFOCode# |               
Field Office Email = #strFOEmail# | 
Field Office Name = #strFOName#<br> 
</cfloop>
</cfoutput>

The output I get does list properly all records but also gives me the following error:
<errormessage>
Error Diagnostic Information

An error occurred while evaluating the expression:

strFOCode = #trim(listGetAt(strFO,1))#

Error near line 36, column 7.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to