Solved

Change main form field.

Posted on 2003-11-09
10
241 Views
Last Modified: 2013-12-18
The "main" form has the fields "Name" and "LastName" (computes).
On changing the field "Name" value  (eg. the name is not entered corectly), on Qsave I nedd to search all documents with the field "Name" in db and change its value (some od documents are responses to "main" form but some are not).

I tried with view "AllDocuments" and next script in Qsave:

      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim entry As NotesViewEntry
      Dim vc As NotesViewEntryCollection
      
      Name = Source.FieldGetText("LastName")
      
      Set db = session.CurrentDatabase
      Set view = db.GetView("AllDocuments")
      Set vc = view.GetAllEntriesByKey("Name")
      
      
      Set entry = vc.GetFirstEntry()
      While Not ( entry Is Nothing)
            Set doc = entry.Document
            
            Call doc.ReplaceItemValue( "Name", Name)
            
            Call doc.Save (True, False)
            
            Set entry = vc.GetNextEntry(entry)
            
      Wend
      
-but no result. What is the proper way to solve this task. Thanks.
0
Comment
Question by:nenadkov
[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
10 Comments
 
LVL 14

Accepted Solution

by:
p_partha earned 125 total points
ID: 9711537
I doubt the line :

  Set vc = view.GetAllEntriesByKey("Name")


it shd be changed to

  Set vc = view.GetAllEntriesByKey(Name)

This will fetch all teh records where the key is the value entered in lastname field in the current documnet

Also, the alldocuments view shd have the first column sorted to the Name field.

Hope i make sense

Partha
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 125 total points
ID: 9712256
Here's a more effeicient way than looping through all he view cllection entries:

Use the follwoing:
    vc.stampAll "Name" , name

Instead of:

   Set entry = vc.GetFirstEntry()
     While Not ( entry Is Nothing)
          Set doc = entry.Document
         
          Call doc.ReplaceItemValue( "Name", Name)
         
          Call doc.Save (True, False)
         
          Set entry = vc.GetNextEntry(entry)
         
     Wend
 
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9712328
good suggestion Qwaletee
0
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!

 
LVL 9

Expert Comment

by:Arunkumar
ID: 9714424
That was mine.  Qwaletee do you remember saying that stampAll is inefficient ???  Or was that you Partha ???

;-)

Good morning to all you Experts!
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9714676
Arun,
I didn't say that it was inefficient,. but there are some places where stampall doesn't work as intended....


peace
Partha
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9715014
stampAll is really, really efficient.  Sometimes a little to efficient -- if the document you are working on is in teh collection, you can get conflicts.
0
 

Expert Comment

by:spacediver
ID: 9736669
How to incorporate a Search Function in the Document Library?
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9736727
spacediver,
> How to incorporate a Search Function in the Document Library?
By asking your own question?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

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