Add Const MANDATORDB, Fix ui, Add Log buttons

This commit is contained in:
Jonathan Jenne
2022-03-31 14:30:16 +02:00
parent 9df22e098a
commit 374eb57268
16 changed files with 160 additions and 60 deletions

View File

@@ -327,12 +327,16 @@ Namespace Documents
For Each oField In oRow.Fields
If oTable Is Nothing Then
Logger.Warn("Table [{0}] was not found in the Schema. Exiting.", oRow.TableName)
Exit For
End If
Dim oColumn = oTable.Columns.Where(Function(c) c.Name = oField.Key).SingleOrDefault()
If oColumn Is Nothing Then
Logger.Warn("Column [{0}] was not found in Table [{0}]. Skipping.", oField.Key, oTable.Name)
Continue For
End If
Dim oFunctionName = oColumn.Config.FunctionName
@@ -340,32 +344,42 @@ Namespace Documents
Dim oParamsDict = ParseFunctionParamsAsDict(oFunctionParams)
If oFunctionName = Constants.FUNCTION_FIELD Then
Try
Logger.Debug("Applying function FIELD to field [{0}]", oField.Key)
Dim oParam = oParamsDict.FirstOrDefault()
Dim oParam = oParamsDict.FirstOrDefault()
If IsNothing(oParam) Then
Logger.Warn("FIELD function needs exactly one parameter!")
Continue For
End If
If IsNothing(oParam) Then
Logger.Warn("Function FIELD needs exactly one parameter. Skipping")
Continue For
Dim oFieldName = oParam.Key
Dim oSubKey = oParam.Value
Dim oReferencedField = oRow.Fields.
Where(Function(field) field.Key = oFieldName).
FirstOrDefault()
If IsNothing(oReferencedField) = False Then
Dim oValue As String = Utils.NotNull(oReferencedField.Value.GetValue(oSubKey), String.Empty)
If oValue <> String.Empty Then
oField.Value.Final = oValue
End If
Else
Logger.Warn("Referenced Field [{0}] was not found!", oFieldName)
Continue For
End If
Dim oFieldName = oParam.Key
Dim oSubKey = oParam.Value
Dim oReferencedField = oRow.Fields.
Where(Function(field) field.Key = oFieldName).
FirstOrDefault()
If IsNothing(oReferencedField) = False Then
Dim oRawValue = oReferencedField.Value?.GetValue(oSubKey)
Dim oValue As String = Utils.NotNull(oRawValue, String.Empty)
If oValue <> String.Empty Then
oField.Value.Final = oValue
End If
Else
Logger.Warn("Referenced Field [{0}] was not found. Skipping.", oFieldName)
Continue For
End If
Catch ex As Exception
Logger.Warn("Function FIELD could not be applied to field [{0}]. Skipping.", oField.Key)
Continue For
End Try
End If
Next
Next