laatzen/Pruef2000/source/CVakoCode.cls
2021-10-01 11:11:04 +02:00

88 lines
2.3 KiB
OpenEdge ABL

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "CVakoCode"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Const VAKO_TABELLE = "VAKO_Merkmale"
Private m_dicWerte As scripting.Dictionary
Private mstrVakoCode As String
Public Function GetVakoCode() As String
GetVakoCode = mstrVakoCode
End Function
Public Function load(strVakoCode As String) As Boolean
Dim rs As CRecordset
Dim rs1 As CRecordset
Dim strSQL As String
Dim strBasis As String
Dim intStelle As Integer
Dim intLaenge As Integer
Dim strWert As String
If strVakoCode = "" Then Exit Function
mstrVakoCode = strVakoCode
strSQL = "SELECT * FROM " & VAKO_TABELLE & " WHERE Basis = SUBSTRING('" & strVakoCode & "',1,len(Basis)) AND (Charcode = SUBSTRING('" & strVakoCode & "', Stelle, Laenge))"
Debug.Print strSQL
Set rs = New CRecordset
rs.openRS strSQL, True
If rs.EOF Then
load = False
Exit Function
Else
load = True
End If
Set m_dicWerte = New Dictionary
Do While Not rs.EOF
intStelle = rs.getIntValue("Stelle")
strWert = rs.getStringValue("Wert")
Debug.Print intStelle & ": " & rs.getStringValue("Name") & " : " & rs.getStringValue("Schluessel") & "," & rs.getStringValue("Charcode") & "="; strWert
If Not rs.isFieldNull("Schluessel") Then
If rs.getStringValue("Schluessel") <> "" Then
On Error Resume Next
If Not m_dicWerte.Exists(rs.getStringValue("Schluessel")) Then
m_dicWerte.Add rs.getStringValue("Schluessel"), strWert
Debug.Print " ==>" & rs.getStringValue("Schluessel") & " = " & strWert
End If
Else
Debug.Print strWert
End If
End If
rs.MoveNext
Loop
End Function
Public Function GetWert(strName As String) As String
GetWert = m_dicWerte.Item(strName)
End Function
Public Property Get VakoCode() As String
VakoCode = mstrVakoCode
End Property