Hallo,
ich habe in meinen Template nun eine neue Funktion hinzugefügt,das Feld möchte
ich nun ein Script in allen meinen Dokumenten setzen.
Um das Feld handelt es sich um ein Optionfeld, das vorher nicht
im Dokument vorhanden war.
Hier der Code:
Sub Initialize
Dim wert As String
Dim s As New NotesSession
Dim db As NotesDatabase
Dim tmpdoc As NotesDocument
Set db = s.CurrentDatabase
Dim strTextArray(0) As String
strTextArray(0) = "0"
Dim item As NotesItem
Dim v As NotesView
Set v = db.GetView("German\Unread")
Dim doc As NotesDocument
Set doc = v.GetLastDocument()
Do While Not (doc Is Nothing)
Set item = doc.GetFirstItem( "Doc_freigabe" )
item.IsAuthors = True
Call doc.ReplaceItemValue("Doc_Freigabe", strTextArray)
item.IsAuthors = False
Call doc.Save(True,True)
Set doc = v.GetLastDocument()
Loop
End Sub
In einer Ansicht schaue ich nun nach ob das Feld geändert wurde, aber dies
ist nicht der fall. Ich frage mich nun warum??
Ein weiters Problem ist.... :
Da ich in der Datenbank nun aber ca. 2.8gb an Dokumenten habe ,
suche ich nach eine Möglichkeit, das bei der nächsten Replikation nur dieses
Feld geändert wird und nicht gleich die komplette DB als neu angesehen wird.
Gruß Jörg
Set item = doc.GetFirstItem( "Doc_freigabe" )
item.IsAuthors = True
Call doc.ReplaceItemValue("Doc_Freigabe", strTextArray)
item.IsAuthors = False
Call doc.Save(True,True)
Set doc = v.GetLastDocument()
Heisst das Feld jetzt Doc_freigabe oder Doc_Freigabe ?
Warum einmal IsAuthors = true und dann IsAuthors = False ?
Warum 2 x GetLastDocument ?
@Werner
nun ja dann bin ja mal beruhigt, da es so ca. 1500 Dokumente sind... :)
@Klauss
ein Problem vorher war , das ich das Feld nicht bearbeiten konnte da bei
Author des items false zu lesen war. DAher dachte ich mir so dann setzen wir
die Rechte und nach setzen ich sie wieder so wie es war.
Wenn ich im Script das letzte GetLastDocument entferne , dann
läuft das ganze in einer Endlos-Schleife.
Den Code-Teil hatte ich hier im Forum gefunden und dort wurde
dies als Lösung kundgetan.
Auch mit diesen Code bekomme ich nicht die gewünschte
Änderungen in den Dokumenten. D.h. meine Abfrage beliebt
leer.
Sub Initialize
Dim wert As String
Dim s As New NotesSession
Dim db As NotesDatabase
Dim tmpdoc As NotesDocument
Set db = s.CurrentDatabase
Dim strTextArray(0) As String
strTextArray(0) = "0"
Dim item As NotesItem
Dim v As NotesView
Set v = db.GetView("German\Unread")
Dim doc As NotesDocument
Do While Not (doc Is Nothing)
Set item = doc.GetFirstItem( "Doc_Freigabe" )
item.IsAuthors = True
Call doc.ReplaceItemValue("Doc_Freigabe", strTextArray)
Call doc.Save(True,True)
Set doc = v.GetLastDocument()
Loop
End Sub
GRuß Jörg
So ganz verstehe ich das nicht (Montag)...
Warum nimmst Du nicht die Mimik mit getfirst & next Document ?
Beispiel:
Set doc = view.GetFirstDocument
While Not ( doc Is Nothing )
If doc.LastModified < Today Then
Call doc.Send( True, doc.Authors )
End If
Set doc = view.GetNextDocument( doc )
Wend
Sub Initialize
Dim wert As String
Dim s As New NotesSession
Dim db As NotesDatabase
Dim tmpdoc As NotesDocument
Dim doc As NotesDocument
Dim strTextArray(0) As String
Dim v As NotesView
Set db = s.CurrentDatabase
strTextArray(0) = "0"
Set v = db.GetView("German\Unread")
set doc = v.getfirstdocument()
While Not (doc Is Nothing)
Call doc.ReplaceItemValue("Doc_Freigabe", strTextArray)
Call doc.Save(True,True)
Set doc = v.GetNextDocument(doc)
Wend
End Sub
Oder ganz ohne Loop
Sub Initialize
Dim wert As String
Dim s As New NotesSession
Dim db As NotesDatabase
Dim tmpdoc As NotesDocument
Dim doc As NotesDocument
Dim strTextArray(0) As String
Dim v As NotesView
Set db = s.CurrentDatabase
strTextArray(0) = "0"
Set v = db.GetView("German\Unread")
call v.allEntries.stampAll("Doc_Freigabe",strTextArray)
End Sub
Morgen,
ein aktuelle Code kein Problem:
Sub Initialize
Dim wert As String
Dim s As New NotesSession
Dim db As NotesDatabase
Dim tmpdoc As NotesDocument
Dim doc As NotesDocument
Dim strTextArray(0) As String
Dim v As NotesView
Set db = s.CurrentDatabase
strTextArray(0) = "1"
Set v = db.GetView("German\Unread")
Set doc = v.getfirstdocument()
While Not (doc Is Nothing)
Call doc.ReplaceItemValue("Doc_Freigabe", strTextArray)
Call doc.Save(True,True)
Set doc = v.GetNextDocument(doc)
Wend
End Sub
Kann dies aber auch an der Definition des Feldes liegen??
Der Wert welcher geändert werden soll ist eine Optionsschaltfläche.
Gruss Jörg
1. Es gibt in LS einen Debugger
2. Evtl. mal Errorhandling / Debug ausgaben einbauen
Sub Initialize
Dim wert As String
Dim s As New NotesSession
Dim db As NotesDatabase
Dim tmpdoc As NotesDocument
Dim doc As NotesDocument
Dim strTextArray(0) As String
Dim v As NotesView
Set db = s.CurrentDatabase
strTextArray(0) = "1"
Set v = db.GetView("German\Unread")
print db.server & " " & db.filepath
Set doc = v.getfirstdocument()
While Not (doc Is Nothing)
Call doc.ReplaceItemValue("Doc_Freigabe", strTextArray)
Call doc.Save(True,True)
Set doc = v.GetNextDocument(doc)
Wend
End Sub