Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

agent to read a view and use the unique id to find inherit document

agent to read a view and use the unique id to find inherit document

agent to read a view and use the unique id to find inherit document

I would like update my "inherit values" on a form with an agent. I have already one view with the records(parents) updated by my user with a specific flag to trace them. I have a view where my children are listed. Now, I have to generate the agent to read the first view, access the second one, find the correct records and update them
but here.... I'm blocked. I'm not able to write properly my lotusScript to do it.... Please help, what I'm doing wrong ?



RE: agent to read a view and use the unique id to find inherit document

Try something like this. I haven't tested it but I think it should work.


Sub Initialize
'Visit all main documents to get values
'Verify values on response document to main and update if they are different
        Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim parentDoc As NotesDocument
    Dim responseDoc As NotesDocument
    Set db = session.CurrentDatabase
    Set view = db.GetView( "View Name" )    
    Set parentDoc = view.GetFirstDocument
'START: Visit each main document in the view
    While Not ( parentDoc Is Nothing )
'START - Get values of main doc

' and so on with all fields you wish to update    

'END - Get values of main doc    
'START: Visit each of the parent's response documents        
    Set responseDoc = view.GetChild( parentDoc )
    While Not (ResponseDoc Is Nothing )
'START - Get values of resp doc    
    If v1<>ResponseDoc.field10) Then
    End If    
    If v2<>ResponseDoc.field2(0) Then
    End If
    If v3<>ResponseDoc.field3(0) Then
    End If
' and so on for all your response do fields

'END - Get values of resp doc
                            Call ResponseDoc.ComputeWithForm( False, False )
    Call ResponseDoc.Save( True, True )
    Set responseDoc = view.GetNextSibling( responseDoc )
    Set parentDoc = view.GetNextSibling( parentDoc )
    'END: Visit each main document in the view
End Sub


Hope this helps

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close