Solved

Set a field in another form.

Posted on 2004-04-19
17
213 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

615 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