title: Dereference a scalar variable of type class
body: <p>I am trying to loop through a .csv file, depending on one column value i the go further to see if a file with the same name as the value in the column exists</p>
  
  <p>the code i am using is as follows:</p>
  
  <pre><code>&lt;cffile action="read" file="C:/ColdFusion10/cfusion/wwwroot/kelly2/debitorders.csv" variable="csvfile"&gt;
  
  &lt;cfoutput&gt;
  &lt;cfloop index="index" list="#csvfile#" delimiters="#chr(10)##chr(13)#"&gt;
  
      &lt;cfif FileExists(ExpandPath(listgetAt('#index#',5).txt))&gt;
      xxx
      &lt;/cfif&gt;
  
         #listgetAt('#index#',1)#&lt;br&gt;
         #listgetAt('#index#',2)#&lt;br&gt;
         #listgetAt('#index#',3)#&lt;br&gt;
         #listgetAt('#index#',4)#&lt;br&gt;
         #listgetAt('#index#',5)#&lt;br&gt;
         #listgetAt('#index#',6)#&lt;br&gt;
         #listgetAt('#index#',7)#&lt;br&gt;
         #listgetAt('#index#',8)#&lt;br&gt;
  &lt;/cfloop&gt;
  &lt;/cfoutput&gt;
  </code></pre>
  
  <p>however when i run it i get the following error:</p>
  
  <pre><code>You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.
  
  
  The error occurred in C:/ColdFusion10/cfusion/wwwroot/kelly2/upload.cfm: line 6
  4 : &lt;cfloop index="index" list="#csvfile#" delimiters="#chr(10)##chr(13)#"&gt;
  5 : 
  6 :     &lt;cfif FileExists(ExpandPath(listgetAt('#index#',5).txt))&gt;
  7 :     xxx
  8 :     &lt;/cfif&gt;
  </code></pre>
  
  <p>i have tried putting the cfif tags into a try and catch, according to google this fixed the issue for most people, but it did not work for me</p>