From 83f026d38989660cd1ed3a98d1078c7d0bd9df3f Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Mon, 13 May 2019 12:37:01 +0200 Subject: [PATCH] WIP: Remove empty rows --- Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb b/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb index e04f4782..18007ebf 100644 --- a/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -320,6 +320,32 @@ Public Class ImportZUGFeRDFiles _logger.Debug("Done Fetching Property values.") + + Dim oIndexesToRemove As New List(Of Integer) + + For oRowIndex = 0 To oRowCount - 1 + Dim oColumnIsEmpty = False + + For Each oRow In oPropertyList + Dim oValue As List(Of Object) = oRow.Value.Item(oRowIndex) + Dim oIsEmpty = oValue.Count = 0 + oColumnIsEmpty = oIsEmpty + + Console.WriteLine($"Value is empty: {oValue.Count = 0}") + Next + + If oColumnIsEmpty Then + oIndexesToRemove.Add(oRowIndex) + End If + + + + Console.WriteLine($"Column is empty: {oColumnIsEmpty}") + Next + + ' TODO: Remove Empty Rows by `oIndexesToRemove`! + + ' Structure of oPropertyList ' [ # Propertyname # Row 1 # Row 2 ' PositionsMenge: [BilledQuantity1, BilledQuantity2, ...], @@ -358,7 +384,7 @@ Public Class ImportZUGFeRDFiles oPropertyValue = String.Empty End If - _logger.Debug("Property {0} has value {1}", oPropertyDescription, oPropertyValue) + _logger.Debug("Property {0} has value '{1}'", oPropertyDescription, oPropertyValue) Dim oCommand = $"INSERT INTO {oTableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER) VALUES ('{oFileGroupId}', '{oPropertyDescription}', '{oPropertyValue}', {oRowCounter})" _logger.Debug("Mapping Property {0} to value {1}. Will be inserted into table {2} with RowCounter {3}", oPropertyDescription, oPropertyValue, oTableName, oRowCounter)