Domino 9 und frühere Versionen > ND6: Entwicklung

Evaluate @ReplaceSubstring -> Fehlermeldung

<< < (3/4) > >>

dnotes:
Das Ergebnis von Evaluate ist richtig. Wie greifst Du denn auf den Wert von evaluate zu?? Evaluate liefert eine Array zurueck.

Axel:

--- Zitat von: dnotes am 22.12.05 - 13:33:27 ---Das Ergebnis von Evaluate ist richtig. Wie greifst Du denn auf den Wert von evaluate zu?? Evaluate liefert eine Array zurueck.

--- Ende Zitat ---

Jaein. Der Rückgabewert von Evalute ist ein Variant-Datentyp.


Dim result as Variant

result = Evaluate(.....


Axel

stitze:
Passiert leider das gleiche, Type Missmatch, k.A. ich werd mich glaub ich morgen früh nochmal dem Prob widmen, dann hab ich was Abstand und erkenn vieleicht was ich da wieder für einen Usel gemacht habe.

Thx erstmal und falls euch nochwas einfällt, ich bin ganz Ohr

Sebastian

Axel:
Poste doch mal deinen Code. Vielleicht sieht man ja was.


Axel

stitze:

--- Code: ---Sub Click(Source As Button)

               On Error Goto ErrHandler

Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim docCollection As NotesDocumentCollection

Dim doc As NotesDocument
Dim docSetDate As NotesDocument

Dim nam As NotesName

Dim item As NotesItem
Dim itemAlleInformationen As NotesItem

Dim aryInformation() As String
Dim aryHistory(30, 2) As String
Dim strUnID As String
Dim strName As String
Dim strDatum As String
Dim strNewValue As String
Dim strDocument As String
Dim strMyBlank As String
Dim strEvalString As String
Dim strOp As String

Dim intCount As Integer
Dim intStringPos As Integer
Dim intLength As Integer
Dim i As Integer
Dim j As Integer

Dim valEval As Variant
Dim aryClean

Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document

Set item = doc.GetFirstItem( "lstAenderungsbriefe" )
Set itemAlleInformationen = doc.GetFirstItem( "txtAlleInformationen" )

'Iteriere über markierte Datensätze in dem Textfeld "txtAlleInformationen"
Forall entry In itemAlleInformationen.Values
Redim Preserve aryAlleInformationen( intCount ) As String

'Speichere Datensatz in Array "aryAlleInformationen"
aryAlleInformationen( intCount ) = entry

intCount = intCount + 1
End Forall

intCount = 0

'Iteriere über das Listenfeld "lstAlleInfomrationen" und inkrementiere bei jedem markierten Datensatz "intCount" um 1
Forall entry In item.Values
If Not entry = "" Then intCount = intCount + 1
End Forall

'Falls mind. ein Datensatz markiert is
If Not intCount = 0 Then
intCount = 0

strMyBlank = " "

'Iteriere erneut über das Listenfeld "lstAenderungen"
Forall entry In item.Values
Redim Preserve aryInformation( intCount ) As String

Forall entryAll In itemAlleInformationen.Values
intLength = Len( entryAll )

strDocument = Left( entryAll, intLength - 32)

strOp = " - "
strEvalString = {@ReplaceSubstring("} & strDocument & {"; "} & strOp & {"  ; "} & strMyBlank & {")}

valEval = Evaluate( strEvalString )

strDocument = valEval

If entry = strDocument Then
strUnID = Right( entryAll, 32 )
End If
End Forall

'Ermittle UniversalID des markierten Datensatzes
'strUnID = Right( entry, 32 )

'Hole Dokument mit Hilfe der UniversalID
Set docSetDate = db.GetDocumentByUNID( strUnID )

'Setze das Publikationsdatum
docSetDate.PubDatum = doc.datPublikation(0)

i = 1

'Pflege die Historie

'Überprüfe ob schon Änderungen am Dokument vorliegen
If docSetDate.getItemValue( "Historytemp" )(0)  <> "" Then
'Wenn ja iteriere über das Feld "Histoytemp"
Forall entryHistory In docSetDate.GetItemValue( "Historytemp" )
'Speicher den kompletten Datensatz im Array "aryHistory" an der stelle (i,0)
aryHistory( i, 0 ) = entryHistory

'Ermittle die Endposition des Namens
intStringPos = Instr ( entryHistory , "~~~" )-1
'Speichere den Namen in der Variable "strName"
strName = Ltrim( Rtrim( Left( entryHistory, intStringPos ) ) )
'Speichere Namen im Array "aryHistory" an der Stelle (i,1)
aryHistory( i, 1 ) = strName

'Ermittle mit Hilfe der Varibale "intStringPos" das Datum speichere dieses in der Variable "strDaum"
strDatum = Ltrim( Rtrim( Mid( entryHistory, intStringPos + 4 ) ) )

'hinterlege das Datum im Array "aryHistory" an der Stelle (i,2)
aryHistory( i, 2 ) = strDatum

'ermittle die Anzahl der Einträge im Feld indem die Variable "i" jeweils um 1 inkrementert wird
i = i + 1
End Forall

End If

'Erzeuge ein NotesName Objekt, übergebe dem Konstruktor den Namen des aktuellen Users
Set nam = session.CreateName( session.UserName )

'Speichere den Abbreviated Namen ("John B Goode/Sales/East/Acme/US") incl. dem Datum und der Uhrzeit im Array "aryHistory" an der Stelle (0,0)
aryHistory( 0, 0 ) = nam.Abbreviated  + "~~~" + Now()

'Zerpflücke diesen Datensatz ebenfalls, s.o.
intStringPos = Instr ( aryHistory( 0, 0 ), "~~~" )-1
strName = Ltrim( Rtrim( Left( aryHistory( 0, 0 ), intStringPos ) ) )

aryHistory( 0, 1 ) = strName

strDatum = Ltrim( Rtrim( Mid( aryHistory( 0, 0 ), intStringPos + 4 ) ) )

aryHistory( 0, 2 ) = strDatum

'Leere das Feld "Historytemp"
Set item = docSetDate.ReplaceItemValue( "Historytemp", "" )

'Falls mehr als 30 Einträge im Feld sind, setzte die Variable "i" auf 30, gefährleistet, das nur die letzten 30 Änderungen zu sehen sind.
If i >= 30 Then i = 30

'Speichere die Historieninformationen neu im Feld "Historytemp"
For j = 0 To i - 1

strNewValue = docSetDate.GetItemValue( "Historytemp" )(0) & aryHistory( j, 0 ) & ","

Call docSetDate.ReplaceItemValue( Historytemp, strNewValue )
Next

If i = 1 Then
Call docSetDate.ReplaceItemValue( "Historytemp", aryHistory( 0, 0 ) )
End If

'Speicher das Dokument
Call docSetDate.Save( True, False )

'Speicher die publizierte Schlüsselbeschreibung in einem Array
aryInformation( intCount ) = entry

intCount = intCount + 1
End Forall

'Lösche alle leeren Einträge aus dem Array
For i = 0 To Ubound( aryAlleInformationen )
For j = 0 To Ubound( aryInformation )
If aryAlleInformationen( i ) = aryInformation( j ) Then
aryAlleInformationen( i ) = ""

j = Ubound( aryInformation ) - 1
End If
Next
Next

aryClean = Fulltrim( aryAlleInformationen )

itemAlleInformationen.Values = ""

'Füge den gesäuberten Array dem Item "itemAlleInformationen" hinzu
For i = 0 To Ubound( aryClean )
itemAlleInformationen.AppendToTextList( aryClean( i ) )
Next

uidoc.Refresh
Else
'Falls nicht gebe eine Fehlermeldung aus
Msgbox "Sie müssen einen Datensatz auswählen.", MB_OK, "Fehler"
End If

Ende:
Exit Sub   

ErrHandler:
Call arOutputError(constrObjectName, Err, Erl(), Error())
Resume Ende

End Sub

--- Ende Code ---

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln