To insert a subform

Hi all, I’m new to lotus notes… First time using subforms…If anything wrong, plz guide me using it.

I have a field in my form(response) which gets numbers into it from a configuration form(parent).Based on the numbers in the field, I want to populate computed subforms. I wrote the formula as

@if(@GetField(sect_name)=1";“Section1”;“”) in the default value of the subform,I’ve enabled the “Insert formula” option in the subform properties…

(section1 is my computed subform name).

It’s not working… what may be the problem?..

Subject: To insert a subform

use@if(@getfield(“sect_name”)=1;“Section1”;“”) add this in u r computed subform tag in the response(main) form.

To verify why the condition doesnt works use another subform name in else part, check wheather the condition is always going for the else condition

Subject: RE: To insert a subform

i tried with the else condition by giving

@If(@GetField(sect_name)= “1”; “Section1”; “Section2”)

but its showing that "Section2 not loading " in the status bar and the form is still empty.

Subject: RE: To insert a subform

As Kannapan indicated, you are using the value stored in sect_name, e.g. “Central Area” instead of the field when you use @GetField(sect_name).

Therefore, you are trying to get the value based on something lilke, @GetField(“Central Area”), instead of @Getfield(“sect_name”).

Why use @GetField at all?

Why not just use

@If(sect_name=“1”;“Section1”;“”)

Subject: RE: To insert a subform

Please make sure following 2 points.1. Subform name is correctly mentioned. This is case sensitive

  1. You have subforms by names mentioned in the if condition.

Subject: RE: To insert a subform

I think that your problem may be related to when the computed SubForm formula is evaluated. The formula is during the opening of the form (I think right after the QueryOpen event if my memory serves me right). So if you are populating the field after that point then the subform is not computed. Try the following:1. Open a new document and populate the Section field.

  1. Close the document and re-open it.

Is the subform properly created?

If this is the case then you can some code to set the field then close teh UIDoc and re-open it. This usually just causes the screen to flash for a moment.

Here is a code snippet that I have used to do soething similar to that.

Call current_doc.computewithform(True, False)

Call UI_Workspace.SetTargetFrame(“”)

Set new_uidoc= UI_Workspace.editdocument(True, current_doc)

current_uidoc.document.saveoptions = “0”

Call current_uidoc.close

'refresh the document

Call new_uidoc.reload

new_uidoc.refresh

You could hang this on a button that would call for the user to enter a Section number then store that in the appropriate field then call this sort of code. all it is doing is setting two instances of the same document in the UI then closing the older one and opening the newer one. May take a bit of playing with when you do the Section selection but so long as the right section # is in the New_UIDoc before it is reloaded it should work OK.

Subject: To insert a subform

maybe this

@If(@Contains(sect_name;“1”) ;“Section1”;“”)

or

@If(@Contains(sect_name;“1”) ;“subfromread”;“subformedit”)

Subject: RE: To insert a subform

I mus thank all for the great response… I tried Tim’s n got it …I made a simple mistake in all the fields of the subforms… I’ve written hide-when in all the fields of the subforms… I forgot to remove those when i copied into the subforms…