Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Change main form field.

Posted on 2003-11-09
10
Medium Priority
?
249 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
10 Comments
 
LVL 14

Accepted Solution

by:
p_partha earned 500 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 500 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

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
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

927 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