Get a handle on the uidoc from an embedded view

Hi

Is this possible? I have embedded views, and want to be able to use data in the uidoc from an action on the embedded view (because I also want to do stuff with the selected documents). The view could be in a dialog box as well as a normal uidoc

I’ve tried w.currentdocument, but that doesn’t get anything at all.

Cheers

Dan

Subject: Dana’s Solution

http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/1ddf91c00d704ac485256d2f00461d2d?OpenDocument

Subject: get a handle on the uidoc from an embedded view

If you have Notes 6, use

Dim Docid As Variant

Docid = uiview.CaretNoteID

If you have n5 it’s not that easy ( as far as I know ), in this case the caretCat must be unique for each doc.

Use Dim bnaam As Variant

bnaam = uiview.CaretCategory

Dim sv As notesview

Set sv = uiview.view

Set doc = sv.Getdocumentbykey(bnaam)

Reards,

FS

Subject: RE: get a handle on the uidoc from an embedded view

Folkert,

Thanks for replying, but I think what you’re saying is how to get a handle on the doc selected in the embedded view.

I can do this, but I want to get a handle on the uidoc that the embedded view is embedded in.

Cheers

Dan

Subject: RE: get a handle on the uidoc from an embedded view

Hmm… Maybe on open of the uidoc, set an environment var and get it from the view??

Subject: RE: get a handle on the uidoc from an embedded view

It’s an option, I might try it. Thanks a lot

Dan

Subject: get a handle on the uidoc from an embedded view

If you are opening a doc in the embedded view, you can do something like this:Dim ws as New NotesUIWorkspace

Dim uidoc as NotesUIDocument

Set uidoc = ws.CurrentDocument

Alternatively, if you are using an embedded view, you may be using single category. If so, you will have data on the doc being open that identifies the uidoc. If you had a lookup view selecting the these uidocs, sorted by this key you could get the uidoc from the view.

This is very useful if maintaining totals in the uidoc, based upon the sum of data stored in in the individual docs.

let me know if this does not help

Subject: RE: get a handle on the uidoc from an embedded view

Dominic

Thanks for responding, but I’m not able to get either of your options working.

I think the problem lies in the fact that I’m trying to use an action on the view that’s embedded.

set uidoc = w.currentdocument doesn’t return a uidoc, and using the global variable option works when running an action from the document, but not when using the action on the embedded view.

The problem is that I need to use the action off the embedded view, because I need to get the docs from the view.

Any other suggestions?

Cheers

Dan

Subject: RE: get a handle on the uidoc from an embedded view

Hi Dan

How are the documents selected for the embedded view?

Are you saying that within the embedded view, you want to select n documents and click a button that will use data in the uidoc to update the selected docs in the embedded view?

Your previous reply suggested that you are not using a single category view. Does the embedded view select responses? If so, the $Ref field will have the UNID of the parent, and that can be used to get the uidoc, (db.GetDocumentByUNID).

Subject: RE: get a handle on the uidoc from an embedded view

Thanks again Dominic

Unfortunately, while the view is a single category view, they aren’t responses to the parent doc, and contain no info about the doc the view is embedded in.

I’ve now changed the design slightly to get rid of this need, it just means one extra step for the user which I would have liked to have got rid of.

Thanks for your suggestions

dan

Subject: RE: get a handle on the uidoc from an embedded view

Hi Dan

If the view is a single category, there should be a solution. A field on the uidoc must store the single category. You can therefore locate the uidoc in a view using the category as the key.

All the best

Dominic

Subject: RE: get a handle on the uidoc from an embedded view

Dominic - This does not solve the problem of “selecting” some of the documents in the embedded view. I too have that need (as I’ll bet a zillion others have) - consider simple things like an action button to toggle the value of a field in selected documents. Your solution would work for the whole category but not a subset of the category.

embedded views and editors have a lot of potential but seem to come up short in many areas.

Subject: RE: get a handle on the uidoc from an embedded view

Subject: Another possible solution for you

This may help, this is what I’m doing…

When the user opens the main doc, the postopen event saves the docunid in a field in a profile doc. Then, from an action in the embedded view, I open a dialog box for inputs. The postopen event of the dialog box calls up the docunid from the profile doc and puts it in a field on the dialog box form. My own ‘save’ button on the dialog box then calls LS code to do further processing - and I have access to the main doc thru the docunid stored in the uidoc (the dialog box).

Works like a charm. hth