c=filetostr("your.csv") IF llUTF8 && a parameter passed, I'm not reading BOM because it's often missing. c=STRCONV(STRCONV(c,11),2) ENDIF lnRows=alines(this.aRows, c)Now parse the first line into this.aFldNames (and check for any rubbish, as in repeated names, names in multiple lines etc etc, this array is your source of field names); keep the column count somewhere.
function getrow(ii) lcRow=this.aRows[ii] do while ["] $ lcRow * now here do a strextract of anything between quotation marks, with end delimiters * replace it back without quotes and with commas replaced with, say, pipes lcRow=strtran(lcRow, lcCut, lcReplace) enddo * now split into fields lnCols=alines(aValues, lcRow, -1, -1, ",") o=createobject("empty") for ij=1 to lncols lcVal=chrtran( aValues[ij], "|", ",") addproperty(o, this.aFldNames[ij], lcVal) endif * lots of error handling needed here - lnCols may differ from the size of aFldNames etc etc. return o