0 pts.
 Dynamically display computed subform based on combobox selection
I need to display a computed subform when a user selects an entry in a combo box. I have subforms named corresponding to the entries in the combo box and it is set up to refresh on keyword change. The subform formula specifies the the combo box name. Is seems this should be a no-brainer but doesn't work. I could put all the subforms on the form and use the hide property or use sections but I didn't want to go that route. Any help would be appreciated, thanks

Software/Hardware used:
ASKED: May 27, 2005  6:45 PM
UPDATED: May 31, 2005  11:46 AM

Answer Wiki:
I agree this seems like a no-brainer, but it's not. All subform names that need to be displayed has to be known when the form opens. Hide-Refresh formulas have no effect. The way I have dealt with this is to have a compose script that prompts the user for a keyword, creates the document and saves it to disk, then displays it to the user in edit mode. When this is done, the proper subform displays. This is a tiny code snippet with no detail on how I prompt the user. Let me know if you need more. A forumula solution follows this code. Dim workspace As New NotesUIWorkspace Dim session As New notessession Dim db As notesdatabase Dim doc2 As notesdocument Set doc2 = db.CreateDocument 'Prompt for keyword value 'set keyword value that controls subform selection doc2.form = "MainDocument" Call doc2.save(True, True) Set uidoc = workspace.EditDocument(True, doc2) Another way that I've made this work using formula is to give the user a form button that they click, prompt for a value, then end with a switch form to the same form name. This seems to work as well. Rem "Code to prompt user for a value that subform will use to display"; Rem "set the keyword field value selected"; @PostedCommand( [ViewSwitchForm] ; "MainDocument" )
Last Wiki Answer Submitted:  May 27, 2005  7:40 pm  by  Brooklynegg   3,845 pts.
All Answer Wiki Contributors:  Brooklynegg   3,845 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I also had this problem and I managed to display the sub-form finally by doing the following.

Create a hidden text field named “FIELD1″ and populate the field with the selected value from combo box.
And in the default value of computed field type FIELD1.

Good luck.

 0 pts.

 

Thanks for the replies, this is a web app which I forgot to mention.
It does not make sense that I can dynamically display a subform based on user security but not from the value of a field. I think the problem lies in the refresh on keyword change, that must not re-evaluate the subform formulas.

thanks

 0 pts.