Domino 9 und frühere Versionen > Entwicklung

ArrayAppend (wieder mal)

(1/3) > >>

Don Pasquale:

Hallo Leute,

ich möchte mir eine Historienfunktion erstellen, die
nur gezielt Veränderungen protokolliert, dazu nutze ich
die folgende Fukction. Die allerdings nur dann funktioniert
wenn das Feld $Historie bereits Einträge funktioniert.
Das ArrayAppend hängt nur dran ( das deutet der NAme ja
auch an).
Bei einem leeren $Historie bekomme ich aber ein Type Mismatch.

Irgendwelche Vorschläge ?

Ciao

Don Pasquale

Function makeHistorieneintrag ( unid As String, User As String, Text As String) As Integer
   
   Set HEUTE = New NotesDateTime( "Heute" ) ' As String   
   Dim Eintrag As String
   
   Eintrag = Cstr(Heute.localtime) & " " & User & " " & Trim$(Text)
   Dim session As NotesSession
   Dim db As NotesDatabase
   Dim doc As NotesDocument
   Set session = New NotesSession
   Set db  = session.CurrentDatabase
   Set doc = db.GetDocumentByUNID(unid)
   
   
   
   If Not (doc Is Nothing) Then
      
      If doc.~Historie = "" Then
         doc.~Historie = Eintrag
      Else
         doc.~$Historie =  Arrayappend( doc.~$Historie, Eintrag )         
      End If
      
   End If
   
End Function

Axel:
Hi,

versuch's mal damit:

If Not (doc Is Nothing) Then
     
      If doc.~Historie(0) = "" Then
         doc.~Historie = Eintrag
      Else
         doc.~$Historie =  Arrayappend( doc.~$Historie, Eintrag )        
      End If
     
   End If

Axel

doliman:
Hi,

Deine Variable Eintrag ist vom Typ Text und kein Variant.

Auzug aus der Designer Hilfe:

ArrayAppend( v1 As Variant, v2 As Variant ) As Variant v3
Elements
v1  
Any variant containing an array.
v2  
Any Variant .
Return value
v3  A variant containing an array.
Usage
v2 and v1 are not modified.
If v1 And V2 are of the same type, the array produced (v3) will be that type.
If v1 and v2 contain different variable types, then the array (v3) will be constructed as an array of variants,
Each variant contains the type found in either v1 or v2.
The lower bound of v3 is the same as the lower bound of v1.  
Error Conditions :
If v1 is not an array,   a Type Mismatch error is thrown.
If the array bounds of the constructed array are outside acceptable array limits, an Subscript out of range error is thrown.
If an array with more than one dimension is used, a Type Mismatch Error is thrown.

Don Pasquale:
@Axel

Die Fehlermeldung verschwindet, allerdings
wird immer noch kein erster Eintrag erstellt.

@Doliman:

Ich verstehe Deinen Kommentar nicht,
es ja nur der erste Eintrag der NICHT
klappt. Besteht bereits ein Eintrag so
klappt meine Funktion wunderbar.

Ciao

Don Pasquale

doliman:
Hi,

ein Type Mismat(s)ch entsteht häufig wenn unterschiedliche Variablentypen ineinander kopiert werden. Da Du Text der ArrayAppend übergeben hast war mein Gedanke, dass Notes dies nicht verstanden hat in Variant zu "casten".

Andere Frage:
Ist das Feld Bestandteil Deiner Maske oder befüllst Du dieses auf dem Backend. Wenn es nicht als Feld vorhanden ist, probiers mal mit call doc.replaceitemvalue("$History", Eintrag) da Felder mit diesem Dollar nicht immer richtig funzen (hatte auch mal problem damit). Machst Du ein Saveoder ein Reload auf das Doc?

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln