Solved

Script on view to update selected documents with values from another doc chosen by user

Posted on 2007-04-05
6
191 Views
Last Modified: 2013-12-18

I have a projects database with a view of all project documents (Column 1 is project Name, Col 2 is Project Code)
I have a requests database with a view of all requests.
I want an action on this allrequests view that allows the following :

1. Presents user with a list of all project names in the project database (Col 1)
2. User selects a project name
3. All the documents the user has selected in the view are updated with the project name and it's associated project code.

Thanks

0
Comment
Question by:intouchsystems
[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
  • 2
6 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 18858936
Easy enough. Use a prompt or dialog box to show the projects, do a DBlookup to grab the name and code and do a loop on selected docuemnts ( Collection ) to replace th fields.
I'll see if I have some code.

0
 
LVL 22

Accepted Solution

by:
Bill-Hanson earned 500 total points
ID: 18860157
Sure, just create a LotusScript agent in the Requests db that operates on all selected documents.  Paste the code below as a starting point and replace the variables (SERVER, FILEPATH, Field names...) as required.

Sub Initialize
      
      Dim sess As New NotesSession()
      Dim ws As New NotesUiWorkspace()
      Dim dbCurrent As NotesDatabase
      Dim dbProjects As New NotesDatabase("SERVER", "FILEPATH")
      Dim dcProjects As NotesDocumentCollection
      Dim dcSelection As NotesDocumentCollection
      Dim docProject As NotesDocument
      Dim docSelected As NotesDocument
      
      Set dbCurrent = sess.CurrentDatabase
      Set dcProjects = ws.PicklistCollection(3, False, dbProjects.Server, dbProjects.FilePath, "PROJECT_VIEW_NAME", "Select Project Name", "")
      If (dcProjects.Count = 0) Then Exit Sub
      Set docProject = dcProjects.GetFirstDocument()
      
      Set dcSelection = dbCurrent.UnprocessedDocuments
      Set docSelected = dcSelection.GetFirstDocument()
      Do While (Not docSelected Is Nothing)
            
            docSelected.ProjectName = docProject.GetItemValue("Name")(0)
            docSelected.ProjectCode = docProject.GetItemValue("Code")(0)
            Call docSelected.Save(True, False)
            
            Set docSelected = dcSelection.GetNextDocument(docSelected)
      Loop
      Call ws.ViewRefresh()
      
End Sub
0
 

Author Comment

by:intouchsystems
ID: 18863158
Hi Bill

Thanks for the code - however I get an error - Variant Does Not Contain a Container.
This occurs immediately. I've checked the path names for the picklist and it all looks ok

Any ideas?
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18863266
Which line?
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

756 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