1 Reply Latest reply on Jun 13, 2011 12:25 PM by Jush

    get array values

    Jush

      Please advice how could I get the value of phone number and language  name from the following dump: I want to display all elements in a table.

      here is the component.

      http://ria.dzone.com/sites/all/files/Figure7_2.png

      here is the page to display:

      <cfscript>
      ORMReload();
      employees = EntityLoad( 'Employee' );
      </cfscript>
      <cfoutput>
      <table border = "2">
        <tr>
          <th>ID</th>
          <th>First Name</th>
          <th>Last Name</th>
          <th>Salary</th>
          <th>Department</th>
          <th>Phone</th>
          <th>language</th>
        </tr>
      <cfloop array="#employees#" index="i">
        <tr>
          <td>#i.getEmp_ID()#</td>
          <td>#i.getFirstName()#</td>
          <td>#i.getLastName()#</td>
          <td>#i.getSalary()#</td>
          <td>#i.getDepartment().getDEPT_NAME()#</td>
          <td>
              <!---<cfloop>--->
          </td>
          <td>
              <!---<cfloop>--->
          </td>
        </tr>
      </cfloop>
      </table>
      </cfoutput>

       

       

      Thanks.

        • 1. Re: get array values
          Jush Level 1

          find it out. Here is the solution.

          <cfloop array="#employees#" index="i">
            <tr>
              <td>#i.getEmp_ID()#</td>
              <td>#i.getFirstName()#</td>
              <td>#i.getLastName()#</td>
              <td>#i.getSalary()#</td>
              <td>#i.getDepartment().getDEPT_NAME()#</td>
              <td> 
                  <cfloop array="#i.getPhoneNumbers()#" index="j">
                      (#j.getareaCode()#) #j.getphoneNumber()#
                  </cfloop>
              </td>
              <td> 
                  <cfloop array="#i.getLanguages()#" index="k">
                       <li>#k.getname()#
                  </cfloop>
              </td>
            </tr>
          </cfloop>