Domino 9 und frühere Versionen > ND7: Entwicklung
UNID
ch:
Hallo,
ich habe eine Frage ich möchte prüfen ob es in einer DB ein Dokument mit einer bestimmten UNID gibt.
Bei Set bricht Notes ab wenn es keine Dok. gibt und Errorhandling hat nicht funktioniert.
Gibt es eine möglichkeit wie:
IF db.getDocumentByUNID(doc.zuDokiD(0))=true then
eine Schleife aufzubauen??
lg claudia
Glombi:
Mit einem vernünftigen Errorhandling sollte das machbar sein.
Es geht auch so: Erstelle eine Ansicht ohne Antworthierarchie, die nach
@Text(@DocumentUniqueID)
sortiert ist.
Dann:
set dc = view.getDocumentbyKey( doc.zuDokiD(0), true )
if dc.Count = 0 then
msgbox "Dok nicht da"
End if
Andreas
diali:
mit dem Errorhandling muss es aber funktionieren.
Wie sieht den Dein Script-Code aus?
ch:
%INCLUDE "lsxbeerr.lss"
Sub Initialize
REM Archivierung...
Dim session As New NotesSession
Dim db As NotesDatabase
Dim arcdb As New NotesDatabase("","chug_kop.nsf")
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Dim doc3 As NotesDocument
Dim wert As Variant
Dim wert1 As Variant
Dim wert2 As Variant
Dim wert3 As Variant
Dim wert4 As Variant
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
While Not doc Is Nothing
wert4 = doc.GetItemValue("status")
If wert4(0) = "offen" Then
REM offen und noch keine UNID vorhanden..
On Error lsERR_NOTES_ERROR Goto label1
Set doc3 = arcdb.getDocumentByUNID(doc.zuDokiD(0))
label1:
wert = doc.GetItemValue("Titel")
wert1 = doc.GetItemValue("Name")
wert2 = doc.GetItemValue("Thema")
wert3 = doc.GetItemValue("Telefonnummer")
Set doc2 = New NotesDocument( arcdb )
doc2.Form = "Task"
doc2.TaskType = "1"
doc2.Categories = "offene Telefonate"
doc2.TaskType = "1"
doc2.tmpOwnerHW = "1"
doc2.tmpNoActionBar = "1"
doc2.NoticeType = ""
doc2.~_ViewIcon = 8
doc2.Subject = wert(0) & " - " & wert1(0) & " - " & wert3(0) & " - " & wert2(0)
Call doc2.ComputeWithForm(False, False)
Call doc2.Save( True, False )
If doc2.Save( True,False ) Then Messagebox "Document " & doc.UniversalID & " successfully saved"
doc.zuDokiD = doc2.UniversalID
Call doc.Save( True, False )
Goto schleife
Schleife:
End If
Set doc = dc.GetNextDocument( doc )
Wend
End Sub
diali:
den Abschnitt mit der Fehlerbehandlung würde ich anders machen
On Error goto Next
set doc3 = arcdb.getDocumentByUNID(doc.zuDokiD(0))
if err <> 0 then
' Fehler gefunden
' ...
err = 0
else
' keine Fehler gefunden
end if
On error Goto 0
Navigation
[0] Themen-Index
[#] Nächste Seite
Zur normalen Ansicht wechseln