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

Posted on 2007-07-23
Last Modified: 2013-12-24
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:

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:
  <cfloop from="1" to="#ArrayLen(theList)#" index="i">
      <td><!--- item no --->
          #trim(listGetAt(theList, 1))#
      <td><!--- issue --->
            #trim(listGetAt(theList, 2))#

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
Question by:geraldw
    LVL 14

    Accepted Solution

    you will need to reference the position in "theList" Array

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

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

    Author Comment

    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.


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
    Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now