1 Reply Latest reply on Aug 10, 2006 11:13 PM by Newsgroup_User

    Repeat region / looping with cfobject

    Level 7
      I apologize in advance, I am very new to CFCs.

      I invoked a cfc using <cfobject> to pull records from the database.
      What I need to know is where can I find information on how to loop the
      records from the cfc / database to show then on a page.

      Here is my object:

      <cfobject name="ProjectList" component="sf_main.components.SingleProjects">
      <cfset myProjects = ProjectList.ListProjects()>

      It pulls the first record just fine, but I need them all listed. Is there
      anything else I need to add to the object to be able to pull multiple
      records. If I were to do it using a <cfquery> I would just use the <cfoutput

      Here is what I would like to loop:

      <table width="100%" border="0">
      <tr valign="top">
      <td width="5%" valign="middle"><div align="center">
      <form name="edit_project" id="edit_project"
      <input name="Edit_project" type="submit"
      class="maintext_small" id="Edit_project" value="Edit" />
      <td width="8%" valign="middle"><div align="center">
      <form name="removeproject" id="removeproject"
      method="post" action="">
      <input name="project_id" type="hidden" id="project_id"
      value="<cfoutput>#myProjects.project_id#</cfoutput>" />
      <input name="Submit" type="submit"
      class="maintext_small" value="Remove" />
      <td width="25%" valign="middle"
      <td width="22%" valign="middle"><div align="left"
      <td width="20%" valign="middle"><div align="center"
      <td width="15%" valign="middle"><div align="center"
      <div align="center"></div>
      <div align="center"></div></td>
      <td width="5%" valign="middle"><div align="center"><cfif
      #myProjects.live# EQ 1>
      <span class="maintext_btblue_bold">Yes</span>
      <span class="maintext_bold">No</span>
      Wally Kolcz
      Developer / Support