You are here:  » How do you skip a row if the first column in the row is empty?


How do you skip a row if the first column in the row is empty?

Submitted by jwp on Sat, 2010-03-06 20:49 in

Hi David,

I would like to skip an entire row - if the first column in the record is empty. I've tried to accomplish this in my record handler, but I haven't had success yet. My record handler just puts the next value from column 2 in the array, and every column in that row is offset by -1.

Here is my sample data:

header 1, header 2, header 3
value 1, value 2, value 3,
,value 4, value 5

Row 3 has no header 1 value, but is being populated with 'value 4', and offsetting the row by -1 column.

Here is my record handler:

foreach($record as $key=>$value){
if($value != ''){
print '<p>';
print $value . '<br />';
print '</p>';
}
}

I've also tested this record handler:

foreach($record as $key=>$value){
if($value != 'NULL'){
print '<p>';
print $value . '<br />';
print '</p>';
}
}

I think the solution is to alter the magic parser code, but I'm not sure where to start.

I need to do this because a row without a valid column 1 value cannot be parsed in my program.

Best,
Jeremy

Submitted by support on Sat, 2010-03-06 20:57

Hi Jeremy,

If you download the latest distribution that should correct the problem for you - the same anomaly was spotted by another user recently and I fixed the issue in the source...

Cheers,
David.

Submitted by jwp on Sat, 2010-03-06 21:15

Hi David,

Thanks for the prompt reply. I still seem to have the same issue.

I wonder if I'm downloading the most recent version? I unzipped the file and the enclosed PHP files were updated on January 14, 2008.

Best,
Jeremy

Submitted by jwp on Sat, 2010-03-06 21:20

I thought it might be useful to reference the original file too:

{link saved}

Best,
Jeremy

Submitted by support on Sat, 2010-03-06 21:32

Thanks, Jeremy;

I've verified the date of the version that you are using, and it corresponds with the fix so I have downloaded the sample file and will check it out for you... please bear with me as I'm on the road this weekend however I shall be online regularly but may be a little slower than normal to reply...

Cheers,
David.

Submitted by jwp on Sat, 2010-03-06 21:36

Hi David,

No problem. Thank you for your assistance. Please let me know if you need additional details.

All the best,
Jeremy

Submitted by support on Sun, 2010-03-07 11:07

Hi Jeremy,

I've spotted the condition causing the problem in this particular scenario; I'll email the fix to you to check out...

Cheers,
David.

Submitted by jwp on Sun, 2010-03-07 17:40

Just wanted to let you know the fix worked. I appreciate the quick turn-around time.

Kind regards,
Jeremy