Solved

Change main form field.

Posted on 2003-11-09
10
237 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
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…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 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

10 Experts available now in Live!

Get 1:1 Help Now