RichardH1976
asked on
Creating new documents from a view with specific fields copied.
Hello,
I am new to Lotus Script and looking for a few pointers on the code I am trying to create. I need to take a nightly copy of all the documents in a certain view so that I can look at specific data. I plan to use an agent to compile this code but at the moment I am using a Action Button to make the copy.
The code I have come up with seems to compile with no errors but does not copy the documents
Sub CopyItems
Dim s As New NotesSession
Dim db As NotesDatabase
Dim View As NotesView
Dim docB As NotesDocument
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set View = db.GetView("Customer")
Set doc = View.GetFirstDocument
Set docB= db.createdocument
Do While Not (doc Is Nothing)
docB.Form= "INVOICEFORM"
docB.INVOICE100 = doc.ColumnValues(2)
Call docB.save (True, True)
Set doc = view.getnextdocument (doc)
Loop
End Sub
Any help appreciated. Richard
I am new to Lotus Script and looking for a few pointers on the code I am trying to create. I need to take a nightly copy of all the documents in a certain view so that I can look at specific data. I plan to use an agent to compile this code but at the moment I am using a Action Button to make the copy.
The code I have come up with seems to compile with no errors but does not copy the documents
Sub CopyItems
Dim s As New NotesSession
Dim db As NotesDatabase
Dim View As NotesView
Dim docB As NotesDocument
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set View = db.GetView("Customer")
Set doc = View.GetFirstDocument
Set docB= db.createdocument
Do While Not (doc Is Nothing)
docB.Form= "INVOICEFORM"
docB.INVOICE100 = doc.ColumnValues(2)
Call docB.save (True, True)
Set doc = view.getnextdocument (doc)
Loop
End Sub
Any help appreciated. Richard
You'll end up with duplicate documents, only the form name will be different.
Is that what you want?
It seems like a big overhead, maybe there's a better way to accomplish what you need.
So, if you're interested, you can explain in more detail what are you trying to check/achieve?
If you want to implement tracking of field value changes, there's a great solution i can recommend...
If you want to back up documents, there's also a better way to do it...
Is that what you want?
It seems like a big overhead, maybe there's a better way to accomplish what you need.
So, if you're interested, you can explain in more detail what are you trying to check/achieve?
If you want to implement tracking of field value changes, there's a great solution i can recommend...
If you want to back up documents, there's also a better way to do it...
ASKER
I want to expose the view I have on the web but our powers to be are nervous of some of the data on the document being viewable. I thought the easiest way would be to create a copy of ALL the documents leaving off the sensitive data.
Any suggestions are appreciated. Richard
Any suggestions are appreciated. Richard
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you need advanced hide-when rules (e.g. only certain role can see, or only certain users) you can use the same text properties tab to specify formula in "Hide paragraph if formula is true" section.
E.g. to show the paragraph only to users that have [NonWeb] role defined in a db's ACL:
@IsNotMember("[NonWeb]";@U serRoles)
E.g. to show the paragraph only to users that have [NonWeb] role defined in a db's ACL:
@IsNotMember("[NonWeb]";@U
ASKER
Perfect. Thanks for your help.
You need to move this line
Set docB= db.createdocument
into the loop, just bellow Do While line.