Manage Learn to apply best practices and optimize your operations.

Show or hide a subform from inside a form

This tip describes how to show or hide a form inside a subform.

Ever used a "Computed Subform" in your form to show a chunk of data, and want to change or hide this subform from INSIDE the form (without exiting and reloading the form)?

This tip is useful if you want subforms loaded or not (or different subforms loaded) based, for example, on an environmental variable, and change them on-the-fly with an action bar on the form itself.


Here's how to do it:

  1. Open the form "myForm"
  2. Create a Computed Subform with the formula:
    @If(@Environment("myVar") = "Y" ; "Sub1" ; "Sub2")
  3. Create two Actions with the following formulas, respectively:
    "Show Sub1"
    @Environment("myVar" ; "Y");
    @Command( [ViewSwitchForm] ; "myForm" )
    and "Show Sub2"
    @Environment("myVar" ; "N");
    @Command( [ViewSwitchForm] ; "myForm" )

Now you can open the form "myForm" and click on the two action buttons to switch between the two subforms, or you can substitute "Sub2" with "" in the Computed subfrom formula to toggle between hide/show of Sub1 subform. Be sure to switch to the SAME form (myForm)!

This option for hide/show of chunks of data is much more efficient than having a section with hide-when formulas, because the section is ALWAYS loaded and THEN hidden, while a Computed Subform is NOT loaded if the formula results in a blank string. If Sub1 contains, for example, an embedded view, you can imagine the performance improvement...

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close