Solved

Change main form field.

Posted on 2003-11-09
10
242 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
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 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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DAOS - Backup / Restore 2 205
Lotus Domino - populate document fields from contents of an inbound email 3 182
Notes > Exchange calendar issues 5 81
Domino Server 2 86
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 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