New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TEIID-4883 Excel Translator Filter Empty Column Cells #951
Conversation
Enhance the excel translator to filter column cells that are empty. This is only enabled when using a header row and when the importer.allowEmptyHeaderRow is true.
@@ -57,12 +57,16 @@ | |||
@ExtensionMetadataProperty(applicable=Column.class, datatype=Integer.class, display="Cell Number", description="Cell number, where the column information is defined. If column name is ROW_ID, define it as -1", required=true) | |||
public static final String CELL_NUMBER = MetadataFactory.EXCEL_URI+"CELL_NUMBER"; //$NON-NLS-1$ | |||
|
|||
@ExtensionMetadataProperty(applicable=Column.class, datatype=Boolean.class, display="Allow Empty Column Name", description="Allow the column information to contain empty cells.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not required, this is only needed if you are adding additional metadata proeprties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok will remove
@@ -156,6 +160,22 @@ private void addTable(MetadataFactory mf, Sheet sheet, String xlsName, String or | |||
Row dataRow = null; | |||
int lastCellNumber = headerRow.getLastCellNum(); | |||
|
|||
// only accept cells that have a value for the name when using a header row |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is effectively truncating the table definition until the first non empty row. Is that the intention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, will only use columns where the header row has non-empty string values. The first empty string cell in the header row marks the end of the table.
btw, also add tests please. |
Added new import property "importer.ignoreEmptyHeaderCells" to skip columns in the header that have a empty column name when a header row is specified. Also changed the default behavior to stop adding columns when the first empty header row cell is detected.
Thank you @dvilaverde |
Enhance the excel translator to filter column cells that are
empty. This is only enabled when using a header row and when
the importer.allowEmptyHeaderRow is true.
See https://issues.jboss.org/browse/TEIID-4883