Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Creating new documents from a view with specific fields copied.

Posted on 2011-02-14
6
Medium Priority
?
355 Views
Last Modified: 2013-11-17
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
0
Comment
Question by:RichardH1976
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 22

Expert Comment

by:mbonaci
ID: 34887666
It creates only one document.
You need to move this line

    Set docB= db.createdocument

into the loop, just bellow Do While line.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34887707
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...
0
 

Author Comment

by:RichardH1976
ID: 34887792
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Accepted Solution

by:
mbonaci earned 2000 total points
ID: 34887889
Use hide formulas on your form (right click on form > Text properties > Hide when tab (second from right) > "Hide paragraph from" section > Check Web browsers).
Be aware that hide formulas work on paragraphs (or table cells), so if you have multiple fields in the same paragraph and want to hide some of them and show the others, create table and place each field in its cell.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34887951
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]";@UserRoles)
0
 

Author Comment

by:RichardH1976
ID: 34888003
Perfect.  Thanks for your help.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question