?
Solved

Trying to output flat file rows as separate rows in a table - CF

Posted on 2007-07-23
2
Medium Priority
?
155 Views
Last Modified: 2013-12-24
Hello,
We're using CFMX 6.1 on Win2003.

I'm reading the following text from a flat file with cffile action=read :
14,test 30,7/23,progress,jw,no|
15,test 31,7/24,done,jw,,|
16,test 32,7/24,done,jw,,|
17,test 40,7/23,in progress,jw,no|
18,test 41,7/24,done,jw,no|
19,atest 43,7/24,done,jw,no|

In the next page I need to show the info in a table while outputting each numbered item as a row in a table:

ISSUE ID      TEST ISSUE     DATE    STATUS    DEVELOPER    UPLOADED
19                atest               7/24       done          jw                       no

I have tried to read the entire file and put it into a LIST:

<cfset theList = ListToArray(issuesList, '|')>

then I try to cfloop through that list with:
<cfoutput>
  <cfloop from="1" to="#ArrayLen(theList)#" index="i">
    <tr>
      <td><!--- item no --->
          #trim(listGetAt(theList, 1))#
      </td>
      <td><!--- issue --->
            #trim(listGetAt(theList, 2))#
       </td>

Anyone who knows what they are doing will see that I don't.  I was thinking that I would make an ARRAY of LISTS and then parse through each one and use LISTGETAT using the comma as the delimiter.

Any ideas would be appreciated.

Thanks, Jerry
0
Comment
Question by:geraldw
2 Comments
 
LVL 14

Accepted Solution

by:
Scott Bennett earned 1000 total points
ID: 19550797
you will need to reference the position in "theList" Array

<cfoutput>
  <cfloop from="1" to="#ArrayLen(theList)#" index="i">
    <tr>
      <td><!--- item no --->
          #trim(listGetAt(theList[i], 1))#
      </td>
      <td><!--- issue --->
            #trim(listGetAt(theList[i], 2))#
       </td>


also as a matter of code readability I would personally never name a vairable containing an array "theList".
0
 

Author Comment

by:geraldw
ID: 19550969
Thanks SBennet,
I've done this before - now that I see your answer!  I'm afraid I've been administrating more than I've been coding lately. Yup, "theList" - bad choice.  It won't make the final cut.

Thanks for your help.

Jerry
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question