Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Set a field in another form.

Posted on 2004-04-19
17
Medium Priority
?
214 Views
Last Modified: 2013-12-18
I have a form that when I click the button done, I should be able to update the parent which is 3 forms up. Form1(Parent),
Form2(child),Form3(child) and Form4(child). When I click done on Form4 I need to update a field in Form1 that will inform me that Form4 has been created (Y,N). THanks
0
Comment
Question by:cyle
[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
  • 9
  • 6
  • 2
17 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10862923
Do you have the parent document id traversing through this chain.. If so you are all set

Use this function

@SetDocField( ParentUNID ; fieldName ; newValue )

~Hemanth
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10862932
Or you have to use script which finds parent iteratively and then updates it ?? Need Code ??
0
 

Author Comment

by:cyle
ID: 10862952
I might need it, but let me try your first suggestion first.
0
Independent Software Vendors: 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!

 

Author Comment

by:cyle
ID: 10862981
Nope, I will be needing that lotus script, I already have this code in the same button:
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim composed As String
Set uidoc = workspace.CurrentDocument
uidoc.EditMode = True
composed = uidoc.FieldGetText( "flagdone" )
  If composed = "N" Then
    If uidoc.EditMode Then
      Call uidoc.FieldSetText("flagdone","Y")
      Call uidoc.Save
      Call uidoc.Close
    End If      
End If

And I do have the parentID in all the other forms.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 10863088
Hi cyle,

Set uidoc = workspace.CurrentDocument
uidoc.EditMode = True



CONST form4flagField = "form4created"
Dim workDoc as notesDocument, parentID as string, parent as notesDocument, db as notesDatabase, parentCounter as integer
Set workDoc = uiDoc.Document
Set db = workDoc.parentDatabase
For i = 1 to 3
   parentID = workDoc.parentDocumentUNID
   set workDoc = db.getDcumentByUNID(parentID)
Next
if workDoc.getItemValue(form4flagField)(0) <> "Y" Then
    workDoc.replaceItemvalue form4flagField , "Y"
    workDoc.save false, true
End if

composed = uidoc.FieldGetText( "flagdone" )
  If composed = "N" Then
    If uidoc.EditMode Then
      Call uidoc.FieldSetText("flagdone","Y")
      Call uidoc.Save
      Call uidoc.Close
    End If    
End If


Cheers!
0
 

Author Comment

by:cyle
ID: 10863394
Sorry, but what is the "form4created"? Is it the default value of the flag field?
0
 

Author Comment

by:cyle
ID: 10868891

For i = 1 to 3
   parentID = workDoc.parentDocumentUNID
   set workDoc = db.getDocumentByUNID(parentID) ----- I debugged it and this part is giving me an "Invalid Universal ID"
Next
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10868975
If parentID is available.. my formula would have worked for you..

Here you have to iterate thru the parent docs.. Let me see if I can post you the code ..
0
 

Author Comment

by:cyle
ID: 10869026
I only have a document number (created using sequential code) which is generated when I save each form. Each form inherits each forms' document number. All forms are responses to Form1.
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 900 total points
ID: 10869249
Use this function to get the top parent of the response

Function GetTopParent As NotesDocument
      Dim s As New NotesSession
      Dim doc As NotesDocument
      Dim parent As NotesDocument
      Set db = s.CurrentDatabase
      Set doc = s.DocumentContext
      Do
            parentUnid$ = doc.ParentDocumentUNID
            If parentUnid$ <> "" Then Set doc = db.GetDocumentByUNID(parentUnid$)
      Loop Until parentUnid$ = ""
      Set GetTopParent = doc
End Function


Usage

Set parentDoc = GetTopParent
if not parentDoc is nothing
parentdoc.Form4Created = "Y"
parentdoc.save true, false
end if
0
 

Author Comment

by:cyle
ID: 10870283
Sigh! Sorry its getting too long, I hope increasing the points will help with all the help you're giving me.
I added this code in Form 4
Function GetTopParent As NotesDocument
 Dim s As New NotesSession
 Dim doc As NotesDocument
 Dim parent As NotesDocument
 Set db = s.CurrentDatabase
 Set doc = s.DocumentContext
   Do
     parentUnid$ = doc.ParentDocumentUNID  ------ this part gives me "Object variable not set"
       If parentUnid$ <> "" Then
        Set doc = db.GetDocumentByUNID(parentUnid$)
       End If
   Loop Until parentUnid$ = ""
   Set GetTopParent = doc
End Function

And this is being called by a "Done" button with this code in Form4

Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim composed As String
Set parentDoc = GetTopParent  -------- calls the function      
Set uidoc = workspace.CurrentDocument
uidoc.EditMode = True
composed = uidoc.FieldGetText( "flagdone" )
If composed = "N" Then
  If uidoc.EditMode Then
    Call uidoc.FieldSetText("flagdone","Y")
    Call uidoc.Save
    Call uidoc.Close
  End If      
End If
End Function
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 600 total points
ID: 10870474
cyle,
>  Set doc = s.DocumentContext

This won't necessarily work when you have a doc open using a form, and want to press abutton on the form.  Use:

Dim workspace as new notesUiWorkspace
Dim uidoc as notesUiDocument
Set uiDoc = workspace.currentDOcument
Dim doc as notesDocument
Set doc = uiDoc.document
0
 

Author Comment

by:cyle
ID: 10870529
Both goes to same form4?
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10878528
It will work qwal..It is always inmemory doc..

Cyle.. Grade B is little discouraging :-(
0
 

Author Comment

by:cyle
ID: 10878560
Honestly, it was an A but my mouse is not working with me today he is faster, I cannot catch up.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10878571
Better take control of your mice or else you will be in trouble :-)
0
 

Author Comment

by:cyle
ID: 10878598
Anyway, thank you.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

719 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