Solved

Change main form field.

Posted on 2003-11-09
10
236 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 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now