Hello All,

I'm trying to loop through a query and output the results as hyperlinks.  I 
would like (if the number of rows exceeds 15) to make 3 columns (in markup) 
with no headers, arranged by SQL fields 'last', 'first' 'mi' and to look 
approximately like this:

link1   link4   link7
link2   link5   link8
link3   link6   link9

I think the way I have my code written now (if I can get it to work) is going 
to mark the links up like so:

link1   link2   link3
link4   link5   link6
link7   link8   link9

...which is acceptable, although on a side-note the former way is preferred.

I get this error when I use the page to run the loop:

[Table (rows 127 columns KCID, FIRST, LAST, MI): [KCID: 
coldfusion.sql.QueryColumn@19f5783] [FIRST: coldfusion.sql.QueryColumn@2a648c] 
[LAST: coldfusion.sql.QueryColumn@12f2b9e] [MI: 
coldfusion.sql.QueryColumn@1d8baaf] ] is not indexable by 1

And here is the code block (cfquery included), I've broken up the link lines 
for better readability:

<cfif !structIsEmpty(form)>
  <cfquery datasource="test" name="getEmployeeList">
    SELECT kcid,first,last,mi FROM DONOR 
    WHERE company='#rsClient.clientName#' 
    AND (last LIKE '%#form.pwe#%' OR first LIKE '%#form.pwe#%')
    ORDER BY last, first, mi
  </cfquery>
</cfif>  

<cfif !structIsEmpty(form)>
  <cfloop query="getEmployeeList">
    <cfif getEmployeeList.recordCount GT 15>
      <tr>
        <td>
          <cfif getEmployeeList[getEmployeeList.currentrow] MOD 3 EQ 2>
            <a 
href="emp_edit2.cfm?id=#getEmployeeList.kcid[getEmployeeList.currentrow]#">
            #getEmployeeList.last[getEmployeeList.currentrow]#, 
            #getEmployeeList.first[getEmployeeList.currentrow]# 
            #getEmployeeList.mi[getEmployeeList.currentrow]#.</a><br />
          </cfif>
        </td>
        <td>
          <cfif getEmployeeList[getEmployeeList.currentrow] MOD 3 EQ 1>
            <a 
href="emp_edit2.cfm?id=#getEmployeeList.kcid[getEmployeeList.currentrow]#">
            #getEmployeeList.last[getEmployeeList.currentrow]#, 
            #getEmployeeList.first[getEmployeeList.currentrow]# 
            #getEmployeeList.mi[getEmployeeList.currentrow]#.</a><br />
          </cfif>
        </td>
        <td>
          <cfif getEmployeeList[getEmployeeList.currentrow] MOD 3 EQ 0>
            <a 
href="emp_edit2.cfm?id=#getEmployeeList.kcid[getEmployeeList.currentrow]#">
            #getEmployeeList.last[getEmployeeList.currentrow]#, 
            #getEmployeeList.first[getEmployeeList.currentrow]# 
            #getEmployeeList.mi[getEmployeeList.currentrow]#.</a><br />
          </cfif>  
        </td>
      </tr>  
    <cfelse>
    <tr><td><a 
href="emp_edit2.cfm?id=#getEmployeeList.kcid#">#getEmployeeList.last#, 
            #getEmployeeList.first# #getEmployeeList.mi#.</a><br /></td></tr>
    </cfif>
  </cfloop>
</cfif> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354159
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to