LS command "Copytodatabase" in Archive Agent : how to add an archive date in the target document WITHOUT adding it to the source document?

LS command “Copytodatabase” in Archive Agent : how to add an archive date in the target document WITHOUT adding it to the source document?

Is it possible (just before the “copytodatabase” statement) to add an “archivedOn” date item to the document to archive WITHOUT saving it?

The code hereunder works perfectly, but for performance reason I’d like to suppress the ‘save’ statement and leave the source document untouched (and just move it to a dedicated folder)

It seems that the new added item is not taken by the ‘copytodatabase’ statement because the document has not been saved…

Thank you by advance for your answers,

Regards,

P Pierlot

Lotus Domino administrator & designer

Belgium

’ LOOP on view MASTERS to Archive *********

totMasts=0

Set vMastToArch = ThisDB.GetView("(vwArchInactMast)")

Set docMastToArch = vMastToArch.GetFirstDocument

While Not (docMastToArch Is Nothing)

	' Process 1 Master

	MastKey=Right("000000"+Cstr(docMastToArch.CyDbNr1(0)),6)+"/"+Right("00"+Cstr(docMastToArch.CyDbNr2(0)),2)

	Call currentLog.LogAction( "Copying Not Active Master " & mastKey)

	' Fill Archive Date

	Dim maDateTime As New NotesDateTime(Now) 'Document Date+ Time

	Dim item As NotesItem

	Set item = docMastToArch.ReplaceItemValue( "ArchivedOn", maDateTime )

	**** I want to avoid this line

	Call docMastToArch.save(True, False)

	****

	Call docMastToArch.CopyToDatabase( ArchiveMast )

	Call docMastToArch.PutInFolder( "mastToDel" )

	' teller + 1

	totMasts = totMasts + 1

	' Next Master

	Set docMastToArch = vMastToArch.GetNextDocument(docMastToArch)

Wend	



Call currentLog.LogAction(  " Not Active companies: " + Cstr(totMasts) + " Masters Archived" )

Subject: LS command “Copytodatabase” in Archive Agent : how to add an archive date in the target document WITHOUT adding it to the source document?

Don’t use “CALL” in your CopytoDatabase method. Change that statement to set a new document.

(at the top of your code) Dim targetDoc as NotesDocument

set targetDoc = docMastToArch.CopyToDatabase( ArchiveMast )

then you can do lines like: targetDoc.ArchivedOn = Now

Subject: RE: LS command “Copytodatabase” in Archive Agent : how to add an archive date in the target document WITHOUT adding it to the source document?

Hi Irving,

According to your advice:

with a new target document, it works now.

Thank you for your fast and useful answer…

:slight_smile: :slight_smile:

Regards,

P Pierlot