?
Solved

Lotusscript - Insert Subform into a Form

Posted on 2011-09-30
6
Medium Priority
?
1,847 Views
Last Modified: 2013-12-18
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
Comment
Question by:Faraj1969
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:cohalex
ID: 36891017
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
 

Author Comment

by:Faraj1969
ID: 36891086
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
 
LVL 4

Expert Comment

by:cohalex
ID: 36891173
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Faraj1969
ID: 36891347
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
 
LVL 4

Accepted Solution

by:
cohalex earned 2000 total points
ID: 36891597
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
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 36899152
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question