Manage Learn to apply best practices and optimize your operations.

Insert A Subform Dynamically

Have you ever encountered the problem like: you have one form and several
subforms, you want to insert only one of the computed subform to the form
depending on the user's selection, instead of putting all the subforms into the
form and controlling the hide-when formula to show the subform. Maybe you can
try this.
1. Let's say if we have one form called "main", and three subform named
"sub1","sub2","sub3".

2. Now, we're going to define which subform should be inserted to the form when
user select. We create another form and name it "link", which has two text
fields: "Option" and "SubformName".
Based on this form, create three documents: Input "option1" and "sub1" (the
subform's name) in the first document, "option2" and "sub2" in the second and
"option3" and "sub3" into the third document.

3. Create a view, name it "subformview", use "Option" field as the first SORTED
column, "Subform" field as the second column (you can hide this column). View
selection fomula:
SELECT Form = "link"

4. Create a view action button called "New Doc":
ENVIRONMENT choosesubform:=@PickList([Custom] ; "":"" ; "subformView" ; "Select
an option" ; "Please select one from the pick list:" ;1);
@Command([Compose]; ""; "main")

5. Open the "main" form in Design mode, create a computed text field named
"selectedoption", write a value formula in this computed field:
@Environment("choosesubform")

Then click where you want to paste the subform, create-insert subform select
"Insert Subform based on formula". Enter the formula that determines which
subform to display.
@If(selectedoption="";"";@DbLookup("Notes":"NoCache";"":"";"subformview";selecte
doption;2))

save the form.
Press "New Doc" button from the view and see you can choose which subform you
want to insert.

Hope this helps

Dig Deeper on Domino Resources - Part 5

Join the conversation

1 comment

Send me notifications when other members comment.

Please create a username to comment.

yes, this is where we use computed subform. we provide formula for computed subform for e.g. something like this:
@If(condition;subform1;subform2)
Cancel

-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