Showing results 1 to 3 of 3

Thread: Reading multiple lines from a CSV file, each line having about 300 data values. There are @100 lines

  1. #1
    Join Date
    23.06.2014
    Posts
    14

    Default Reading multiple lines from a CSV file, each line having about 300 data values. There are @100 lines

    Hi,

    I have been attempting to read a CSV file and populate an array of arrays. I'm using the functions, F_ROPEN, F_SEEK, FM_READ, F_EOF etc..

    The different values of data(type = Dint) are separated by commas in the CSV file, with CR+ LF at the end of each line.

    It looks like this
    5255,0,12236,11927,12089,11803,10369,10524,12009,1 2517,15154,17671,20596,21825,22880...............S ome 300 values......13622,14176,14814,14819,13507,12936,13 378,\r\n


    I find that each value of String read by FM_READ includes the whole line as a string with a limit of 255 characters.  The commas are also included as part of the string! 
    Even if I use spaces or tabs, the same thing happens. FM_Read always returns a string of 255 characters, ignoring the separator values. 
    It looks like this ..

    '1751,1,8702,11897,12119,11271,10281,10963,12158,1 2972,15774,18872,20934,22159,23211,24308,25301,257 70,25994,25915,25966,27523,28414,29155,30170,31736 ,33403,35616,37665,39072,41097,43250,45021,46934,4 7929,48924,50022,51427,52717,53842,54685,56264,577 34,587'

    Kindly guide me how to insert a suitable suitable string terminating character so that each value is read independently as a separate string.

    Thanks and regards



  2. #2
    Join Date
    18.12.2017
    Posts
    55

    Default Re: Reading multiple lines from a CSV file, each line having about 300 data values. There are @100 lines

    Hi!

    String variables have a maximum length of 255 chars.
    Check the part "Text buffers manipulation" in the help file!

    Remember that there is a bit "low level" memory handling involved. Make sure to "clean up" when you are done.

    /Fredrik

  3. #3
    Join Date
    23.06.2014
    Posts
    14

    Default Re: Reading multiple lines from a CSV file, each line having about 300 data values. There are @100 lines

    Thanks Fredrick,

    I have studied the available functions. However none of them are really useful to extract individual data values. My task does not end with reading a line. But actually to parse the comma separated line and extract the individual values between the comma.  If you have any ideas towards this end then please suggest.

Similar Threads

  1. Two Alarm Objects with different amount of lines
    By ronei_candido in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 1
    Last Post: 13th July 2021, 14:05
  2. Reading Values from data archive or generated report
    By arunkumardara in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 1
    Last Post: 4th November 2020, 13:54
  3. Coloring like lines
    By zeynal.sabas in forum zenon Energy Edition
    Replies: 2
    Last Post: 26th April 2018, 11:59
  4. Disable grid lines in trend XY
    By galax in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 2
    Last Post: 3rd April 2013, 09:42
  5. T-Junction of Lines fed by two Sources (ALC)
    By shikra in forum zenon Energy Edition
    Replies: 5
    Last Post: 15th April 2010, 00:35

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •