Solved

Lotusscript - Insert Subform into a Form

Posted on 2011-09-30
6
1,719 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 500 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 Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now