Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: HRaq am 20.09.07 - 15:19:11
-
Hallo Leute,
ich möchte den Wert des Feldes "DeliveredDate" auslesen, und dann alle Dokumente, die nicht von heute sind, archivieren.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim arcdb As New NotesDatabase("" , "archiv.nsf")
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim wert As Variant
Dim nextdoc As notesdocument
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
Do Until doc Is Nothing
Set nextdoc = dc.getnextdocument(doc)
wert = doc.GetItemValue("DeliveredDate")
If wert(0) ="?" Then
Call doc.CopyToDatabase(arcdb)
Call Doc.Remove( True )
End If
Set doc = nextdoc
Loop
Da wo das Fragezeichen steht, hänge ich. Könnt Ihr einem nichtwissenden Admin helfen?
Danke...
-
<> Today.
Das wars schon.
Bernhard
-
Bernhard,
ich wußte, auf dich ist Verlass. :)
Danke
-
:)
-
Moin Leute,
leider funktioniert es doch nicht so, wie ich erhofft hatte. Er nimmt auch die Docs von heute mit und löscht sie dann in der QuellDB. Habe ich einen Fehler in der Syntax?
If wert(0) <> today Then
-
Versuchs mal so :
If wert(0) <> Today() Then
-
Ist die Formatierung identisch?
Aus der Hilfe:
' LotusScript assigns Today’s date to the String
' variable whenNow.
Dim whenNow As String
whenNow$ = Today()
Print whenNow$
' Output:
' 6/7/95
-
Hallo Ingo und Andre,
es ist jetzt so, wie Ingo beschrieben hat - juckt ihn aber nicht....Er nimmt trotzdem die Docs von heute nimmt.......grummel
-
Ich würde mit der NotesDateTime Klasse arbeiten.
Also:
dim ndt_Today as NotesDateTime
dim ndt as NotesDateTime
Dim session As New NotesSession
Dim db As NotesDatabase
Dim arcdb As New NotesDatabase("" , "archiv.nsf")
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim wert As Variant
Dim nextdoc As notesdocument
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
set ndt_Today = New NotesDateTime( Today )
Do Until doc Is Nothing
Set nextdoc = dc.getnextdocument(doc)
set ndt = New NotesDateTime( doc.GetItemValue("DeliveredDate")(0) )
If ndt.DateOnly <> ndt_Today.DateOnly Then
Call doc.CopyToDatabase(arcdb)
Call Doc.Remove( True )
End If
Set doc = nextdoc
Loop
Andreas
-
Was für ein Datentyp hat denn DeliveredDate?
Aber Blödsinn: Wenn in DeliveredDate Date/Time steht, dann vermutlich auch mit Uhrzeitkomponente. Die hat natürlich Today nicht.
Daher muss es heissen (wenn alle Dokumente von vor heute entfernt werden sollen):
wert (0) < Today.
Wenn tatsächlich ein ungleich erforderlich ist:
Clng (wert (0)) <> Today.
Andreas: Die DateTime class braucht man hier wirklich nicht. Kann man natürlich, aber das ist mit Kanonen auf Spatzen geschossen.
Bernhard
-
Ich danke euch allen für die schnelle Hilfe. Ich komme heute nicht mehr dazu, die verschiedenen Varianten zu testen, gebe aber auf jeden Fall ein Feedback.
Also, danke nochmal und ein schönes WE