Skip to content
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

Merged
merged 3 commits into from May 3, 2017
Merged

TEIID-4883 Excel Translator Filter Empty Column Cells #951

merged 3 commits into from May 3, 2017

Conversation

dvilaverde
Copy link
Contributor

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

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.")
Copy link
Member

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

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Contributor Author

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.

@rareddy
Copy link
Member

rareddy commented May 2, 2017

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.
@rareddy rareddy merged commit cac1dde into teiid:master May 3, 2017
@rareddy
Copy link
Member

rareddy commented May 3, 2017

Thank you @dvilaverde

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants