Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1920
  • Last Modified:

Lotusscript - Insert Subform into a Form

Dear Experts

I'm sure this question been asked before, and seriously tried serching before posting a question.

We're using Lotus Notes 8.5, is there a way to insert a Subform via Lotusscript ? If yes, can I get a guidance on how to do it ? Many thanks in advance.
0
Faraj1969
Asked:
Faraj1969
  • 3
  • 2
1 Solution
 
cohalexCommented:
You can use a computed subform (insert from Create\Resource\Embed subform from teh Designer menu) on your main form.
Put the name of a field as value for your subform name.
Use LS to change the field value.

 computed subform
0
 
Faraj1969Author Commented:
OK, seems there's a way, so let me explain it better.

I'm opening a Form through dialogbox, the form should give me a chance to enable/disable sections and to decide if access to the section should be Edit or Read. I created a subform for a single section. When user click on a button, the dialogbox appear and in PostOpen event, it will check how many sections available in database (it's known at runtime, not before) and the PostOpen event will add the subform for every section available. Hope my explanation is clear. Let me know please.
0
 
cohalexCommented:
This is perfectly doable and is a practice in many Notes applications.

Before calling the dialog box to open a given document, you should compute the accesses and set one or more fields in the document to reflect flags for showing / hiding sections and / or computing the subform names. Of course, you will save the document with those flag fields before launching it in the dialog box window.

In your scenario, when the user clicks the button - inside the button script:
- get or compute the accesses
- set flag fields accordingly
- save the document
- call open document in dialog box with a single form

If you want, you can also reset those flag fields on the QueryClose form event, so that after the dialog box window is closed, your doc is the same.

To make it easier for your testing, create those flag fields as visible and editable, play with them, and open close the document if needed to have the refresh (no need for dialog box yet).
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Faraj1969Author Commented:
The solution sounds encouraging, but I'm a bit confused. A key factor here that number of sections is unknown. When the main form opens, on PostOpen event, it will check how many sections available, and add as much subforms, for example, the main form opened and found 5 sections in view, so it inserts 5 subforms then it's being presented to user for modifications. The main form will not be saved, just the data will be extracted and saved elsewhere.
0
 
cohalexCommented:
There are two things here:
- you can use computed subforms to dynamically load the desired subform
- you can have a hide-when formula on the text property of your (computed) subform

Keep in mind that hidden subforms still evaluete all the events and fields contained - they are just not visible, unlike a computed subform that evaluates the subform name to null, where it's like the subform was never added to the main form.

You will need to add all subforms on your form - this is a must.
You will then show / hide only those that are allowed for the current opening.

You will not need any action on the form PostOpen event - the subforms will display correctly based on the hide when formulas.

Hope it's a bit more clear.


And another tip: if you don't want to use flag fields and perform a save on the document, you could move those flag fields in a user profile document - they are special documents which are always loaded in the memory of the user's notes client and easily accessible from both LS and FL.
0
 
Sjef BosmanGroupware ConsultantCommented:
AFAIK, subforms are loaded when the whole form is loaded, so you cannot select a different subform once the form is loaded. You'd have to save the selected subform (name) somewhere and then reopen the document to display the document with the selected subforms.

I could be wrong though...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now