How to loop through the CSV file

Hello

I want to loop through each column in a CSV file.
And while the closure of each column, I want to loop every line starting with line 2 St.

I wrote the code below, but it's a loop in the lines from rank 1.
How can I start the loop from the 2nd row in the CSV file?
(see code below)

Can someone tell me how to proceed?

THX




<!-Download and read the file CSV - TXT->
< cffile action = "read" variable = "C:\Documents and Settings\user\Desktop\EM-CSV\test.csv" file = "csvfile" >

<!-browse the CSV - TXT file on line breaks and insert into the database->
< table border = "1" >


< cfloop index = list 'index' = "' #csvfile # ' delimiters =" #chr (10) ##chr (13) #">"

<!-< cfoutput > #listgetAt('#index#',1, ',') # < / cfoutput > < br >->
< b >
< td > < cfoutput #index # > < / cfoutput > < table >
< td > < cfoutput > #listgetAt('#index#',2, ',') # < / cfoutput > < table >
< td > < cfoutput > #listgetAt('#index#',3, ',') # < / cfoutput > < table >
< /tr >

< / cfloop >
< /table >

Hi Like2Flex,

The problem is that coldfusion does not see

list = "a, b, c, d.

as a list of 9 things you expect. He just sees 4 elements a, b, c and d because Coldfusion does not include two delimiters next to each other.

A solution to the problem is to manually insert a space between two delimiters that are side by side. Here is an example of such a solution




length of the list: #listlen (list) #

Tags: ColdFusion

Similar Questions

  • How to navigate through the CSV file by row and pass it by MFL

    I have a CSV file that got no. n. records with the new line ("N") that separates each record of the

    Each record is of about 10 fields or more delimited by ' |'

    for example.

    11111. "20090316152" | " » 0"| » 0"| » 0"| » 0"| » 0"| "1-7DT-439" | " » "||" N ".

    22222 | "20090216152" | " » 1"| » 0"| » 0"| » 0"| » 0"| "1-7DDI-439" | " » "||" N ".

    33333 | "20090316352" | " » 6"| » 0"| » 0"| » 0"| » 0"| "1-5KK-439" | " » "||" N ".

    The requirement is to read the file using OSB - file adapter and move all records to the MFL for the conversion of XML

    Thank you
    Danny

    What happens when you pass all $body as it is the transformation of MFL?

  • How to write in the csv file - what's wrong with that?

    Hi all

    I created a view that makes all kinds of calculations, now I need to write the output in the csv file. How can I do this through a procedure? Sorry I've never had to create a csv file before and this is my first time.


    Thank you!

    Published by: user5737516 on November 18, 2009 09:47

    See:
    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:1992907061984
    (points to several other links)
    and/or
    http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteflat.html

  • How to loop through the results of a select statement in a process flow?

    Hello

    I use Warehouse Builder 10 g R2.

    I'm trying to implement a loop in a process stream that runs through the results of a select statement.

    In pl/sql, it would be implemented as a for loop by using a slider, but I simply doesn't work how to do this using the loops in the process flow.

    Someone at - it ideas?

    Thank you
    Liffey

    Liffey,
    Look at this thread
    For or while loop a loop in the process flow

    Kind regards
    Oleg

  • How do I save the .csv files

    Hello

    I use 'writing on file measurment' and by defult files are saved as ".lmv". How can I change this to save in ".csv" by default.

    Thank you!

    Something like that

  • How to loop through the values of token

    I am trying to create a simple loop that runs through a bunch of values delimited by commas in a string and add them up. What is the best way to do it?

    Currently, my code looks like this

    < cfset basevalue = "0" >
    < cfset count = "1" >
    < cfset token = getToken (myString, count, ",") >
    < cfloop condition = "token QNE NULL" >
    < cfset token = getToken (myString, count, ",") >
    < cfset basevalue = basevalue + token >
    < cfset count = count + 1 >
    < / cfloop >

    This doesn't seem to work. Any ideas?

    I think that the correct syntax is index = "token". If you have some other delimiter then,




    Thank you

  • REGEXP_REPLACE how to loop through the occurrences of a text string variables

    Hello

    I use a 11.g Oracle procedure. I found an example of REGEXP_REPLACE with only two arguments (input and model) and created a procedure based on this example. The Replace function works, but not optimally. I try to use REGEXP_REPLACE to loop on a variable number of occurrences of a text string in a local variable of CLOB.  The string occurs after the text base64 (base64 comma) and before the text "/ > (double quote space oblique superior - only)."  I can do replace it work for a single occurrence, but I can't do it properly in a loop.  These embedded strings include images that were inserted in a rich Apex text field.  This is a rich text field is assigned to the CLOB p_html.

    Declare p_html clob;
      l_image_clob clob;
      l_image_count number;
    Begin
    p_html := '<p>Some header text base64,one start here and then this is the end one" /></p><p>Some header text base64,two start here and then this is the end two" /></p>';
    l_image_count := REGEXP_COUNT(p_html, 'base64', 1, 'i');
    If l_image_count > 0 Then
      For i In 1..l_image_count Loop
      l_image_clob := REGEXP_REPLACE(p_html, '(.*base64,)|(" />.*)');
      dbms_output.put_line(l_image_clob);
      -- code to process each occurrence individually.
      End Loop;
    End If;
    End;

    What I would like to see results of the data are:

    tenure here and that's the end

    two beginning here and that's the end of two

    The results I get are:

    two beginning here and that's the end of two

    two beginning here and that's the end of two

    Thanks a lot for watching this.

    Hello

    From Oracle 11.1, REGEXP_SUBSTR is better than REGEXP_REPLACE for this sort of thing.

    What produces the output you asked for:

    Declare

    CLOB p_html;

    CLOB l_image_clob;

    number of l_image_count;

    Begin

    p_html: = '

    ' Some header text base64, start here and then it's the end "/ >

    Some header text base64, two start here and then it's the end of two"/ >

    ';

    l_image_count: = REGEXP_COUNT (p_html, 'base64', 1, 'i');

    If l_image_count > 0 Then

    For i In 1... l_image_count loop

    l_image_clob: = REGEXP_SUBSTR (p_html )

    , "base64,(.*?)" / > "

    1

    , I - letter i (loop variable), not number 1

    , 'i'

    1

    );

    dbms_output.put_line (l_image_clob);

    -code to treat each case individually.

    End loop;

    End If;

    End;

    /

    The 4th argument to REGEXP_SUBSTR specifies where desired appearance (starting with 1).

    The 6th argument is a backreference. 1 means you want to return all that match the expression starting with the 1st '('. gauche)

  • How to loop through the layers of the children of a group with jsx?

    Need to change the name of a child layers in a group? How to get there?

    Kind regards

    Dorothy

    What is giving you problems?

    Perhaps this example can help:

    #target photoshop
    var theLayers = collectLayers(app.activeDocument.activeLayer, []);
    alert (theLayers.join("\n"));
    ////// function collect all layers //////
    function collectLayers (theParent, allLayers) {
      if (!allLayers) {var allLayers = new Array}
      else {};
      var theNumber = theParent.layers.length - 1;
      for (var m = theNumber; m >= 0;m--) {
      var theLayer = theParent.layers[m];
      theLayer.name = theParent.name + "_" + m;
    // apply the function to layersets;
      if (theLayer.typename == "ArtLayer") {
      allLayers.push(theLayer)
      }
      else {
      allLayers = (collectLayers(theLayer, allLayers))
    // this line includes the layer groups;
      allLayers.push(theLayer);
      }
      };
      return allLayers
      };
    
  • How to navigate through the file to the blackberry playbook using Tablet blackberry OS for Adobe Air SDK

    Hi all

    How to navigate through the file to the blackberry playbook using Tablet blackberry OS for Adobe Air SDK.

    And also I want to download this file on the server.

    Help me by providing examples of coding.

    Thanks in advance.

    With respect,

    Sébille C

    Here are some tips to help you get started.  It all depends on the terms that you use for your search.  For the first, I would use "adobe air browse file."  For the second, I start with only a variation as "adobe air download file" and then adjust according to the first results.

  • ADF: How to manage the value zero when downloading the csv file

    Dear all,

    I'm new in the ADF and use 12.2.1. I am downloading of data in the database using af table: inputfile and CSVParser class. Data download correctly in the database where all columns are met, but whenever the csv file has value null (empty) in his column, then CSVParser class does not recognize it and get the next value of columns and assign the previous column. I also tried another one that uses a different class to download date but not get success.

    For Ex:

    ID name Dept

    1 abc Dept1

    2 cde Dept2

    3 Dept3

    In example above two first line are perfectly inserted in the table while the third line Id goes to ID column, due to the value of the column name is null class CSVParser does not recognize it and put Dept3 in the name column.

    Please help how to handle this.

    Thanks in advance.

    Kind regards

    Hello

    Try with this

    UploadedFile file = (UploadedFile)valueChangeEvent.getNewValue();
    InputStream is = null;
    BufferedReader br = null;
    try {
        is = file.getInputStream();
        br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
        String line = "";
        while ((line = br.readLine()) != null) {
             String[] csvCols = line.split(",");
             // do somethinig smart with csvCols
        }
    }finally{
        if (br != null) try{br.close();}catch(Exception ex){br = null;}
        if (is != null) try {is.close();} catch(Exception exxx){is = null;}
    }
    
  • How create the CSV file delimited by tabs using ORACLE utl_file?

    How create the CSV file delimited by tabs using ORACLE utl_file? Please provide the code sampl.

    This isn't a problem with Oracle, it is a problem with the way you open the data in Microsoft Excel.

    In Excel, you want (depending on your version may vary slightly)...

    Office 2010...

    1. go in the Ribbon "Data".

    2. click on 'text '.

    3. Locate and select your file, and then click "import."

    4 step 1 of the wizard - choose "Delimited", then click on "next >".

    5. step 2 of the wizard - choose "Tab" as the delimiter and click on "next >".

    6. step 3 of the wizard - define types of column as needed (if necessary) and click on "Finish".

    7. check where you want the data in the worksheet.

    Data is loading now in single cells as you expect.

    If you just double-click the CSV, Excel is apparently assuming that it will be separated by commas and does not recognize tabs as separators, unlike when you rename the file with a .xls extension where it examines the file, complains that it is not a content .xls and asks you to confirm that you want to continue loading and then intelligently recognizes the tabs and the format for you.

    As I said, not a problem with Oracle, just a problem with the MS Excel software.

  • How to export a form that has the Asian language in to CSV file? Currently the CSV file shows [...] for the characters of Asian languages

    How to export a form that has the Asian language in to CSV file? Currently the CSV file shows [...] for the characters of Asian languages

    If you export as XML instead, it should work because it uses UTF - 8.

  • How to write the char value as it is in the CSV file

    Hello world

    I create a csv files containing details of the inventory of all products. I am able to create the CSV file utl concepts. My problem starts after the csv file is being created.
    some of the product numbers (although I mean the product number, it is varchar2 data type in the table) is like this 3rd-12, 3rd-54 and so on. I have totally 23 numbers of product like this.
    When the user opens the csv file, it evolves to numbers like this 3.00E - 12, 3.00E - 54. I want to keep the product number because it is like the char value. I tried many methods of submissions and concat.
    But none of them works for me.

    I use oracle 9i.

    Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
    With partitioning, OLAP and Oracle Data Mining options
    Release 9.2.0.7.0 - Production jserver

    Please help me solve this problem.

    Thanks in advance,

    Vimal...

    >
    When the user opens the csv file, it evolves to numbers like this 3.00E - 12, 3.00E - 54. I want to keep the product number because it is like the char value. I tried many methods of submissions and concat.
    But none of them works for me.
    >
    This is because in Excel, the default format for all cells is "Général" and this format is this:
    >
    Format 'Général' Converts numeric values to numbers, values from date to date, and all remaining values to text.
    >
    If you open a file with CSV extension, then each cell uses the format "General".

    You have two choices, and two of them will require the user to go through the text import wizard dialog boxes.

    Save the file with another extension, for example "txt". Then when a user opens the file they will have to select "Delimited" for the file type in step 1 of the wizard and select "next". They will then choose "Comma" as the separator at step 2 of the wizard and select "next". They must then select 'Text' to the data format column in step 3 of the wizard for these two columns, and then select "Finish".

    The other 'Data-> external data' option in the menu and involves the same selections in the wizard.

    You can chat with your users the ability to use a standard for these two columns prefix so that they will be treated as text. If you use "-" as a prefix data will display correctly.

  • How to download the Csv file with column headers

    Hi all

    This is pavan, using Apex version 4.2.3


    I am trying to download the csv file I followed this link , and I'm able to download excel with headers, when I try to download with headers of this error "'ORA-01858: a non-digit character was found here where was waiting for a digital" I searched in google but could not find the right solution, "


    can anyone help on this please.

    Thanks in advance,


    Kind regards

    Pavan

    This article is 6 years old.

    You should study the solutions that are available for APEX 4.2: data loader or the 'Excel2Collection' plugin (which also manages the CSV files).

    Data Loader

    It is a wizard that generates an Assistant for your application.

    Excel2Collection

    You will use the Excel2Collection (in a single process) to convert the BLOB in a Collection

    Then, in a 2nd address), you just do a "INSERT...". SELECT statement.  Add ' where seq_id > 1 "for files with a header.

    MK

    PS - Use the "EXECUTE IMMEDIATE" article is not necessary.

  • How to store the captured data in the csv file

    Here's the sceanario

    I was able to capture data from the oracle forms and store it in variables.
    now, I want to store the same data in the csv file and save this csv file.
    quick reply is appreciated.

    Ok. This is what my, admittedly simple, code performs above: var_orderid col1 and col2 in var_quantity.

    See you soon,.
    Jamie

Maybe you are looking for