MS V 2.6.9 Indexierung Vektorfeld mit Vektor
This commit is contained in:
@@ -2196,9 +2196,10 @@ Public Class frmIndex
|
||||
If oDatatable.Rows.Count = 0 Then
|
||||
Return True
|
||||
End If
|
||||
|
||||
Dim oIndexName As String
|
||||
' 1. Schritt: Einfach-Indexe und Platzhalter ersetzen
|
||||
For Each oRow As DataRow In oDatatable
|
||||
oIndexName = oRow.Item("INDEXNAME")
|
||||
_Logger.Info("Working on AutomaticIndex: " & oRow.Item("INDEXNAME") & "...")
|
||||
Dim oSqlResult As String = oRow.ItemEx("SQL_RESULT", "")
|
||||
Dim oSqlActive As Boolean = oRow.ItemEx("SQL_ACTIVE", False)
|
||||
@@ -2268,33 +2269,51 @@ Public Class frmIndex
|
||||
|
||||
' 2. Schritt: Vektorfelder ersetzen
|
||||
Dim oVectorMatches As MatchCollection = oRegex.Matches(oSqlResult)
|
||||
If oVectorMatches.Count > 0 Then
|
||||
_Logger.Info(" There are " & oVectorMatches.Count & " matches for vectors!")
|
||||
Dim oIsFirstMatch = True
|
||||
|
||||
For Each oVectorMatch As Match In oVectorMatches
|
||||
Dim oIndexValue As String = StripPlaceholder(oVectorMatch.Value)
|
||||
Dim oOptionalIndex = False
|
||||
Dim oManualIndexResult As String = Nothing
|
||||
|
||||
oOptionalIndex = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {CURRENT_DOKART_ID} AND UPPER(NAME) = UPPER('{oIndexValue}')")
|
||||
oManualIndexResult = GetManIndex_Value(oIndexValue, "IDX_AUTO", oOptionalIndex)
|
||||
|
||||
Dim oVectorIndexValues = oManualIndexResult.Split(ClassConstants.VECTORSEPARATOR).ToList()
|
||||
|
||||
For Each oVectorIndexValue In oVectorIndexValues
|
||||
Dim oTempSql = oSqlResult.Replace(oVectorMatch.Value, oVectorIndexValue)
|
||||
Dim oResult = GetAutomaticIndexSQLValue(oTempSql, oSqlConnectionId, oSqlProvider)
|
||||
oEndResult.Add(oResult)
|
||||
Next
|
||||
|
||||
' Verhindert, dass die Schleife mehrmals durchlaufen wird
|
||||
If oIsFirstMatch Then
|
||||
Exit For
|
||||
If oVectorMatches.Count > 0 Or oIndexName.Contains("Vektor") Then
|
||||
Dim oResult = GetAutomaticIndexSQLValue(oSqlResult, oSqlConnectionId, oSqlProvider)
|
||||
Dim oConnectionString As String
|
||||
oConnectionString = DATABASE_ECM.Get_ConnectionStringforID(oSqlConnectionId)
|
||||
Try
|
||||
Dim oResultDT As DataTable = DATABASE_ECM.GetDatatable(oSqlResult)
|
||||
If Not IsNothing(oResultDT) Then
|
||||
_Logger.Info("We got [" & oResultDT.Rows.Count & "] result(s) for the vector-field!")
|
||||
For Each oResultRow As DataRow In oResultDT.Rows
|
||||
oEndResult.Add(oResultRow.Item(0))
|
||||
Next
|
||||
End If
|
||||
oRow.Item("Indexiert") = True
|
||||
oRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray)
|
||||
Next
|
||||
If oEndResult.Count > 0 Then
|
||||
oRow.Item("Indexiert") = True
|
||||
oRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowErrorMessage(ex, $"FillIndexe_Autom - Vektorfield [{oIndexName}] ")
|
||||
End Try
|
||||
|
||||
'Dim oIsFirstMatch = True
|
||||
'D
|
||||
'For Each oVectorMatch As Match In oVectorMatches
|
||||
' Dim oIndexValue As String = StripPlaceholder(oVectorMatch.Value)
|
||||
' Dim oOptionalIndex = False
|
||||
' Dim oManualIndexResult As String = Nothing
|
||||
|
||||
' oOptionalIndex = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {CURRENT_DOKART_ID} AND UPPER(NAME) = UPPER('{oIndexValue}')")
|
||||
' oManualIndexResult = GetManIndex_Value(oIndexValue, "IDX_AUTO", oOptionalIndex)
|
||||
|
||||
' Dim oVectorIndexValues = oManualIndexResult.Split(ClassConstants.VECTORSEPARATOR).ToList()
|
||||
|
||||
' For Each oVectorIndexValue In oVectorIndexValues
|
||||
' Dim oTempSql = oSqlResult.Replace(oVectorMatch.Value, oVectorIndexValue)
|
||||
' Dim oResult = GetAutomaticIndexSQLValue(oTempSql, oSqlConnectionId, oSqlProvider)
|
||||
' oEndResult.Add(oResult)
|
||||
' Next
|
||||
|
||||
' ' Verhindert, dass die Schleife mehrmals durchlaufen wird
|
||||
' If oIsFirstMatch Then
|
||||
' Exit For
|
||||
' End If
|
||||
' oRow.Item("Indexiert") = True
|
||||
' oRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray)
|
||||
'Next
|
||||
Else
|
||||
Dim oResult = GetAutomaticIndexSQLValue(oSqlResult, oSqlConnectionId, oSqlProvider)
|
||||
_Logger.Info("Got a simple SQLResult: " & oResult.ToString)
|
||||
|
||||
Reference in New Issue
Block a user