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

A business partner approached me at Lotusphere with this problem, and after playing around with it a little, it seemed to me the workaround might be useful to others with similar requirements, so here it is.

Requirement: set up the Memo form so that if it contained collapsed sections (e.g. a reply thread), all the sections would be automatically expanded on open.

Problem: the function NotesUIDocument.ExpandAllSections doesn't work when used on a form that has a non-scrolling header, like the Memo form in the Notes mail file. You get the error message "Document command is not available." This was reported as SPR BHUY82WLWZ.

The corresponding @Command ([SectionExpandAll]) does work in this situation, but there was existing LotusScript code in the Postopen event that couldn't be rewritten in formula language.

You can't call a formula that uses the UI from LotusScript (well you can, but it doesn't do anything). So Evaluate and NotesAgent.Run were out. How do we combine the LotusScript event code with the formula command?

Answer: Fortunately, there are duplicate form opening events -- Postopen and onLoad -- so you can put your script in one and the formula in the other. They both execute, though I'm not sure offhand in what order.

Failing that (if it's for a different event), add a subform to the form and write formula for the subform event, and LotusScript for the form event (or vice versa).

Caveat: If there are no sections in the document, @Command ([SectionExpandAll]) returns an error value. If you want to ignore that error, you need another line in your formula to substitute a non-error return value. For instance:

@Command ([SectionExpandAll]);

Andre Guirard | 4 February 2011 12:58:43 PM ET | Home, Plymouth, MN, USA | Comments (1)

Search this blog 


    About IBM Privacy Contact