CE-1955 Make sure to skip blank rows (e.g., no columns had a value)

This commit is contained in:
2025-01-07 11:30:19 -06:00
parent bcedb566ff
commit f7cbf9d1c2
2 changed files with 14 additions and 3 deletions

View File

@ -62,12 +62,22 @@ public class FlatRowsToRecord implements RowsToRecordInterface
QRecord record = new QRecord();
BulkLoadRecordUtils.addBackendDetailsAboutFileRows(record, row);
boolean anyValuesFromFileUsed = false;
for(QFieldMetaData field : table.getFields().values())
{
setValueOrDefault(record, field, null, mapping, row, fieldIndexes.get(field.getName()));
if(setValueOrDefault(record, field, null, mapping, row, fieldIndexes.get(field.getName())))
{
anyValuesFromFileUsed = true;
}
}
rs.add(record);
//////////////////////////////////////////////////////////////////////////
// avoid building empty records (e.g., "past the end" of an Excel file) //
//////////////////////////////////////////////////////////////////////////
if(anyValuesFromFileUsed)
{
rs.add(record);
}
}
BulkLoadValueMapper.valueMapping(rs, mapping, table);