Genii Weblog

Tip: Getting the handle to a doc on an embedded view

Mon 5 Jul 2004, 03:35 PM

by Ben Langhinrichs
I have heard this question many times, but never seen a really good answer that I remember.
Is there a way to get a handle to the selected document in an embedded view?
Rune Carlsen posted an answer to this very question in the Business Partner forum, and I think it is worth re-posting for others to use:

In a embedded view, there is a "target frame (single click)" event: 

Inline GIF image

In this, you can add a formula to catch the unid of the document: 

@SetEnvironment("DocUNID" ; @Text(@DocumentUniqueID))

Now, you can do what ever you want on this document, as you have the UNID. At least in @formulas... 

Best regards;
Rune Carlsen

Copyright 2004 Genii Software Ltd.

What has been said:

177.1. Christopher Byrne
(07/06/2004 07:01 AM)

Most excellent outside the box kind of thinking. I hope he posts this on LDD and that Doug Finnear puts it in the FAQ of FAQs...

177.2. Martin
(07/07/2004 12:37 AM)

Not bad, bud what happen when you have opened more documents with embedded view? :-)

177.3. Martin
(07/07/2004 12:39 AM)

So, I will post another tip - in view action you can use

Set doc = db.GetDocumentByID( work.CurrentView.CaretNoteID) and you have solution in script

177.4. Rune Carlsen
(12.07.2004 04:31)

Thanks for liking it :)