Link to home
Start Free TrialLog in
Avatar of Coast Line
Coast LineFlag for Canada

asked on

creating a custom table for Displaying the Data

Hi, I have the following string and i want to split that string to display data in table format but the way i want to display is not working, Here is the data and here is how it should look like

vendorname- #name#: city-#city#: state-#state#:zip-#zip#:in network-#innetwork#

Open in new window


i want to create the above as the following table:

<table>
<tr>
     <td>vendorname</td><td>#vendorname#</td>
     <td>city</td><td>#city#</td>
     <td>state</td><td>#state#</td>
</tr>
<tr><td>zip</td><td>#zip#</td>
<td>&nbsp;</td><td>&nbsp;</td>
<td>&nbsp;</td><td>&nbsp;</td>
</tr>
</table>

trying to create 6 columns in one TR

Here is try so far

<table align="center" width="100%" border="0" cellpadding="4" cellspacing="6" bordercolor="#CCCCCC;">
  <tr>
    <cfloop index="aPair" list="#Demo_Details#" delimiters=":">
    <cfset Key= listFirst(aPair,"-")>
    <cfif listLen(apair,"-") gt 1>
      <cfset value= listLast(aPair,"-")>
      <cfelse>
      <cfset value = "">
    </cfif>
    <cfoutput>
    <td><strong>#key#</strong></td>
    <td>#value#</td>
    </cfoutput>
    </cfloop>
  </tr>
</table>
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Coast Line

ASKER

so it will be like this

<table ...>
<tr>
<cfset columns = 0>
<cfloop index="aPair" list="#Demo_Details#" delimiters=":">
    <cfset Key= listFirst(aPair,"-")>
    <cfif listLen(apair,"-") gt 1>
      <cfset value= listLast(aPair,"-")>
      <cfelse>
      <cfset value = "">
    </cfif>
    <cfoutput>
    <td><strong>#key#</strong></td>
    <td>#value#</td>
    </cfoutput>
     <cfset columns = columns + 2>
     <!--- start new row and reset --->
     <cfif columns gte 6>
          </tr></tr>
          <cfset columns = 0>
     </cfif>
</cfloop>
</tr>
</table>

i am ooo now, so will try in morning

Thanks
Yeah, that looks right. I'll check back tomorrow.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial