Solved

uidoc not reloading

Posted on 2007-03-29
15
694 Views
Last Modified: 2013-12-18
I have a document with responses displayed in an embedded view.

Actions taken on a response update the status and contents of the log in the parent document.

If I call an action in the parent document which modifies data and saves, before calling an action in the response, the parent status and log are updated (reloaded) when I close the response doc...

However when I open a response, without doing anything to the parent, the status and log aren;'t updated..

Is there a way to avoid this?

uidoc.autreload=true didn't solve the prob..
there are quite a few computed fields but none of them make any changes.. computing their own value

0
Comment
Question by:miklesw
  • 6
  • 3
  • 2
  • +2
15 Comments
 
LVL 19

Expert Comment

by:madheeswar
Comment Utility
You need to place your code. Else we don't know how you are accessing parent document.
Use below code to access Parent doc.
Function GetParentDocument( doc As NotesDocument )
      Dim db As NotesDatabase
      Dim parentDoc As NotesDocument
      Set db = doc.ParentDatabase
      If doc.IsResponse Then
            Set parentDoc = db.GetDocumentByUNID _
            ( doc.ParentDocumentUNID )
      End If
      Set GetParentDocument = parentDoc
End Function
0
 
LVL 1

Author Comment

by:miklesw
Comment Utility
     
                     AuditFileUNID=uidoc.Document.ParentDocumentUNID
      Set docFile = db.GetDocumentByUNID(AuditFileUNID)
      If docFile Is Nothing Then
          Msgbox "Failed to open Audit File Document!!!" ,48,"Accept Retrieval Request"
          Exit Sub
      End If
      docFile.Location="Basement"
      docFile.TransactionHistory =Split(Join(docFile.TransactionHistory,";")& ";" & Now & " - " ....
      Call docFile.ComputeWithForm(False,False)
      Call docFile.Save(True,False,False)
      Call uidoc.FieldSetText("ReturnedBy", sess.UserName)
      Call uidoc.FieldSetText("DateReturned",Cstr(Now))
      Call uidoc.FieldSetText("RequestStatus","Returned")
      uidoc.save
                     Call uidoc.Close(True)            
0
 
LVL 63

Expert Comment

by:SysExpert
Comment Utility
Did you try adding

uidoc.reload
uidoc.refresh

0
 
LVL 22

Expert Comment

by:Bill-Hanson
Comment Utility
The logs are lost because you are saving the parent document in the back-end while it is still open in the front end.

The right way would be to close the parent form while the child is opened for editing, then bring the parent form back up when the child closes.  That way the save to the parent back-end document will not be lost.

Unfortunately, there is a documented bug in the embedded view that prevents us from closing the parent document.  If you try to access a NotesUIDocument in the Queryopendocument event, the Notes client will crash every time.

This code illustrates the bug.  Place this code in the Queryopendocument event of your embedded view to make Notes crash whenever a related document is opened.

      Dim ws As New NotesUIWorkspace()
      Dim uidoc As NotesUIDocument
      Set uidoc = ws.CurrentDocument
      Call uidoc.Save()
      Call uidoc.Close(True)

If IBM would fix this bug, we could develop some very cool relational apps.  Bummer, huh?
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
Well, you may be able to work around a way to close the parent document.  In the PostOpen event of the child doc, use NotesUiWorkspace to open the parent document then close the returned uiDoc handle.  I have not trie dthis, but it might work, since Notes USUALLY tries to open the existing instance of a document window instead of opening an additional instance.
0
 
LVL 22

Expert Comment

by:Bill-Hanson
Comment Utility
I've tried using the PostOpen event as a work around, but the side effects were not acceptable; especially then the document is opened via a DocLink.

The workaround that I use is to design the application such that I never write to a parent document while it is open.  For example, I would create the logs as separate, related documents and show those log documents in another embedded view.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:miklesw
Comment Utility
- sysexpert, the updates take place in the response.. so the uidoc is the response

- qwaltee, uiwork.editdocument in a form event gives an error  :(

Bill, the queryopendocument thing migth work... If the uidoc.close is causing to crash.. (i hope!)

I will try adding a uidoc.save and see what happens (the parent is reloading if I call an action that edits/saves before opening the response)

0
 
LVL 1

Author Comment

by:miklesw
Comment Utility
nsd!!!!!!!!!!!!!
0
 
LVL 1

Author Comment

by:miklesw
Comment Utility
I think the only way to solve it, is to get the Parent doc when it is opened  in the same state as when it is edited/saved...

i just have no idea how to get there..

tried saving in the postopen.. but with no results.
0
 
LVL 22

Accepted Solution

by:
Bill-Hanson earned 250 total points
Comment Utility
The bug prevents any use of the parent.uidoc in queryopendocument of an embedded view.  I've tried every workaround that I can think of to no avail.

One solution that don't really like, but works is this:
1.  Provide an Edit hotspot or button near the embedded view.
2.  When the user clicks Edit, the embedded view is displayed in a picklist.
3.  Operate on the document(s) selected in the picklist

That way, you avoid the embedded view bug, but it is not as clean as if the embedded view bug did not exist.

Also, if you open the document for editing in a dialogbox rather than in the client, you have complete control over the parent form after the response is saved.  Just refresh or reload the form after the call to NotesUiWorkspace.DialogBox.
0
 
LVL 1

Author Comment

by:miklesw
Comment Utility
I added the following to the response's Initialize sub..

      Dim uiwork As New NotesUIWorkspace
      Set uidoc = uiwork.CurrentDocument
      Call uidoc.FieldsetText("amended","xx")
      uidoc.Refresh
      uidoc.save
      Call uidoc.Document.save(False,False)

seems to have done the trick... when intiialize runs, the document hasn't gone to the ui yet...

now i just need to add a few checks (that the uidoc is not nothing and is the correct form) and figure out which of the above are really required.. (uidoc.save wasn't enough to have the parent reload on focus)


0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
Well, don't keep us in suspense.  Let us know what you figured out.
0
 
LVL 1

Author Comment

by:miklesw
Comment Utility
for some reason the parent doesn't reload with uidoc.save

the save on the uidoc's backend doc does the trick
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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