IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

Today's problem: use LotusScript in a page in a frameset, to open a view from a different database in one of the other frames. We don't know at design time what the target database is. We can't change the design of the target database.

NotesUIWorkspace.OpenDatabase always opens in a new tab, so that doesn't help. We can only replace a frame's contents with an element from the same database where the code is running (using OpenView, ComposeDocument, and so forth).

single-frame redirection framesetThe solution I came up with uses a second frameset with just one frame in it. Select "URL" for Type, click the "@" button, and write a formula that reads information from an environment variable or personal profile document, to compute a Notes URL (or you can choose Named Element and write three formulas for element type, database filepath and name). Essentially, when this frameset is opened, it redirects you to whatever's in the Notes URL.

Now you can use SetTargetFrame and NotesUIWorkspace.OpenFrameset to open the "redirect frameset" in the other frame, and that will execute the formula and open the foreign view.

Sub Click(Source As Button)
   Dim dest$
   dest = "notes://etcetera"
   Dim wksp As New NotesUIWorkspace
   Dim session As New notessession
   Call wksp.SetTargetFrame("Frame2")
   Call session.SetEnvironmentVar("FSTarget", dest)
   Call wksp.OpenFrameSet("NavFS")
End Sub

Note: if you can change the design of the target database, I'm told (by Rocky Oliver) that you can instead design a form with a Queryopen event that always sets Continue=False, and uses OpenView or whatever to display the desired design element in the frame. I didn't try it.

Andre Guirard | 17 August 2007 04:00:00 PM ET | Café Porch, Plymouth, MN, USA | Comments (1)


 Comments

1) :-)
Nathan T. Freeman | 8/18/2007 2:36:51 AM

Because we're working on using it for a commercial framework now, I don't want to start handing out demo databases, but here's another giant hint on a way to do this.

Let's say you have form X that is set to auto-frameset, as I do for my embedded frameset trick. The OTHER FRAMES in that auto-loading frameset can refer to fields on that form X in their target computations.

So form X can have a field "TargetFilepath", and a frame other than the one that Form X loads itself into can have a target database @formula of just TargetFilepath, and Balaban's your uncle. The advantages over environment variables and Lotuscript redirects are: a) it's recursive; b) you can have 1 to many instances; c) if you're reading a field off the form -- well, that's not really on a form, is it? That's on a DOCUMENT. So that's where your calculation is really taking place. :-)

Where this gets particularly interesting is when you put the whole structure in an embedded editor.

But now I've said too much. hehe

 Add a Comment
Subject:
   
Name:
Comment:  (No HTML - Links will be converted if prefixed http://)
 
Remember Me?     Cancel

Search this blog 

Disclaimer 

    About IBM Privacy Contact