Can Cicode read data from a CSV file ?

Can Cicode read data from a CSV file ? if so has anyone done it and are willing to share some sample code.

ideally it would be better if the file was .dbf

Parents
  •  Hi  

    Unfortunately, there is no such a Cicode funtion for reading a CSV file. It looks like you have to code it yourself. Here is a guideline

    • Use FileOpen to open a CSV file
    • Use FileExist to test if the file exists before proceeding
    • Given if the file has column headers or not
    • Read each line of the file (While Not FileEOF
    • Use StrSearch to find ","
    • Use StrRightStrMid, and StrLeft to retrieve the content between two "," (use StrLeft for the first and StrRight for the last with StrLength) 
    • You need a predefined array to store the retrieved value of each column.

    Good luck and hope this would help.

Reply
  •  Hi  

    Unfortunately, there is no such a Cicode funtion for reading a CSV file. It looks like you have to code it yourself. Here is a guideline

    • Use FileOpen to open a CSV file
    • Use FileExist to test if the file exists before proceeding
    • Given if the file has column headers or not
    • Read each line of the file (While Not FileEOF
    • Use StrSearch to find ","
    • Use StrRightStrMid, and StrLeft to retrieve the content between two "," (use StrLeft for the first and StrRight for the last with StrLength) 
    • You need a predefined array to store the retrieved value of each column.

    Good luck and hope this would help.

Children
No Data