You are here:  » Parsing problem if first column is blank


Parsing problem if first column is blank

Submitted by minervainfotech on Sat, 2010-04-10 15:44 in

Hello Support,

I have a csv file in which data are like below.

{code saved}

you see above I have total 4 rows. 1st row is header and next 3 rows are records of the property. I used below code to parse the csv file.

MagicParser_parse("csv_file_name", "myRecordHandler", "csv|44|0|34");

function myRecordHandler($record)
{
print_r($record);
}

when I see the output of print_r($record) then for first row it is

$record[FIELD1] = "Acreage" and $record[FIELD2] = "Appliances" and $record[FIELD3] = "Basement" and so on, which is ok.

now problem is for second row. when I print 2nd row then it is showing as

$record[FIELD1] = "Poured,Other-See Remarks" and $record[FIELD2] = "" and so on.

However, it should be

$record[FIELD1] = "" and $record[FIELD2] = "" and $record[FIELD3] = "Poured,Other-See Remarks" and $record[FIELD4] = "" so on.

Please help me on this issue.

Thanks
Kailash.

Submitted by support on Sat, 2010-04-10 15:47

Hello Kailash,

I've come across this condition before and have a fix that I will send to you...

Cheers,
David.

Submitted by minervainfotech on Sat, 2010-04-10 16:06

Hello David,

Thanks for the quick response and the solution. it's worked great.

Regards,
Kailash

Submitted by johnjackson on Wed, 2010-07-07 14:33

Hi David,

I'm having the same problem - please can you email the fix also. I've found that blank columns anywhere in a file seem to cause this issue?

Thanks,

John.

Submitted by support on Wed, 2010-07-07 14:36

Hi John,

On way...

Cheers!
David.