Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Lotusscript - Insert Subform into a Form

Posted on 2011-09-30
6
Medium Priority
?
1,885 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

610 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