This commit is contained in:
Jonathan Jenne
2022-05-05 16:35:22 +02:00
parent f540c1dc17
commit 46d3dfbd47
4 changed files with 24 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
Imports System.Text.RegularExpressions
Imports DigitalData.Modules.Logging
Imports MultiTool.Common.Constants
Namespace Documents
@@ -67,6 +68,7 @@ Namespace Documents
Private _Final As String = ""
Private _External As String = ""
Private _Original As String = ""
Private Logger As Logger
Public Property DataType As ColumnType = ColumnType.String
@@ -95,7 +97,8 @@ Namespace Documents
Public Property PreferExternalValue As Boolean = True
Public Property SortKey As Integer = 0
Public Sub New()
Public Sub New(pLogConfig As LogConfig)
Logger = pLogConfig.GetLogger()
End Sub
Public Function GetValue(pValueType As String) As String
@@ -137,12 +140,14 @@ Namespace Documents
' Set the external value as the final value, overriding the original / previous external value
' if the external value should be preferred
If PreferExternalValue = True Then
Logger.Debug("Setting Final value to [{0}] because PreferExternalValue is True", pValue)
_Final = pValue
End If
' If there is no Original value (because the field is virtual),
' set the external value as the final value regardless of the PreferExternalValue setting
If Original = String.Empty Then
If _Original = String.Empty Then
Logger.Debug("Setting Final value to [{0}] because Original value is empty", pValue)
_Final = pValue
End If
End Sub