Solved

Set a field in another form.

Posted on 2004-04-19
17
212 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
Industry Leaders: 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 300 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 200 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

751 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