Sub Click(Source As Button)
Dim uiws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim db As NotesDatabase
Dim agent As NotesAgent
Dim doc As NotesDocument
Dim noteid As String
Set uidoc = uiws.CurrentDocument
Call uidoc.Save
Set db = uiws.CurrentDatabase.Database
Set agent = db.GetAgent("Get Account Info")
Set doc = uidoc.Document
noteid = doc.NoteID
If agent.RunOnServer(doc.NoteID) <> 0 Then
Msgbox "There was an error looking up the account information.", 48 _
, "New Account Setup"
End If
Call uidoc.Close(True)
Delete doc
Set doc = db.GetDocumentByID(noteid)
Set uidoc = uiws.EditDocument(True, doc)
End Sub
provided by Julian Robichaux at nsftools.com.
SnTT , show-n-tell thursday
Good tip. Here's a way to extend it..
ReplyDeleteI do a lot of interaction with an AS400 from Domino on the AS400 and Domino on a Win Server 2003. I get data using : JDBC, LCLSX, ODBC and can retrieve data to the back end, front end, web, whatever. To prevent you from having to close your Ui document, write the data to a user document in the backend.
So instead, do something like
set doc_user = getMyUserDoc()
noteid = doc_user.NoteID
...
if agent.RunOnServer(noteid)...
set doc_user = db.GetDocumentById(noteid)
....
then write to your uidoc
Neil and Andre put me onto this method, it works great, for more details goto:
http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/fe8b86735eac30a8852570d7004f40d7?OpenDocument
Nick, for some reason the URL you pasted isn't being shown completely. I guess there's some problem with the Blogger comment system. You can put it in a link tag and it'll get converted.
ReplyDeleteI saw some similar techniques to what you're describing on Notes.net, but I didn't really understand why it's a bad thing to close the UI document. It's a lot less work than updating the NotesDocument AND updating the NotesUIDocument. I suppose for web apps it might be a bigger deal, but I don't do web apps.
Here's the link:
ReplyDeletehttp://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/fe8b86735eac30a8852570d7004f40d7?OpenDocument
I did as copy and paste from my last post, the link worked for me.
That's what I used as a basis for what I'm doing. :) The big difference is instead of using a profile as an intermediary I'm using the already loaded NotesDocument. The only downside is I have to close the UI document to show the changes. For me the big benefit is I don't have to save data temporarily, merge it with the UI document, then have all the deletion stubs from the profile documents floating around
ReplyDeleteThere are times when the profile-oriented approach would be the best one, but for me in this situation I saw it as a lot of work without any gain. I wanted to show another solution.