What does using formula for subform mean?

I have a field called status, I want subform details to be inserted , if status=“Actual”, does this means that the document will not have any of the additional fields in this subform if the status is not actual? will this help in making view refresh much better?

Subject: What does using formula for subform mean?

Hello Will Smith2,

The option for subform “Insert Subform based on a Formula” helps you to “load” a particular subform based on a formula you specify. You can display certain details of subform when you open a document if its status is “actual” and can display a different subform or ‘nothing’ if status is not “actual”.

Once saved the document contains the data. If the status changes, even then if you want to display any information from these subform fields, you can do so in the view as they are already saved in the document. Nothing to do with view refresh.

Subject: What does using formula for subform mean?

You are confusing the User Interface (UI) with the back-end document. Also the computed subform is inserted I believe rightafter the Query Open event (It might be just before I can’t remember right off hand) so if the status changes while the document is open in the UI the subform does not change until the next time the document is opened. You can create an action that will close the UIDoc and then re-open it and this will change the subform. If you have several subforms that might be loaded depending on the status then these different subforms may contain someof the same field names, however, if you load two subforms in the same form they must contain unique field names just as if you are adding them to the form.

The data entered with Subform1 will be available when you open it with Subform2 because the data is saved in the back-end document and is independant of the form. You can programmatically add fields to a back-end document that may never appear on a form.

Subject: RE: What does using formula for subform mean?

Tq Bill, for your kind insight. Can you please share with me what I suppose to do in designer, is it I put the @if(STatus=“Actual”) in query open? sorry, I am not that familiar with the queries formula.

Subject: RE: What does using formula for subform mean?

I think that I might have got you off on the wrong foot on this.

When you are creating a new document do you have a value in the status field, and do you want a specific subform to be displayed. In other words:

Status = “New” use subfrmNew

Status = “Active” use subfrmActive

status = “InActive” use subfrmInActive

etc

Here is the problem when opening a new document set the Default value for Status = “New” but I believe that the Computed SubForm formula is cumputed before the Defaults. I went through all of this on an application that I developed but it was years ago. You can test this by having the QueryOpen, Field Default and the computed subform formula all do a print of a message as to where they are. The order of these messages will tell you the computation order.

A refresh of the document does not refresh the computed subform formula, so the only way to get it to recompute is to close the UIDocument and then reopen it. This requires a bit of fancy (but simple) Lotus Script and below is a code snippet of how to do this. Depending on how the Status field is changed this might also be a problem. For example if the Status is changed from “New” to “Active” the subform will not change until the document is re-opened. You could hang some code around the Status field to determine if it has changed and if it hase clode the UIDoc and then reopen it. This generally is pretty quick so the user probably wont even notice it.

From your question I suspect that you are not real familiar with the programming side (No offense meant) and this might take a bit of learning on your part, or find someone that might be able to get you through this.

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

Subject: What does using formula for subform mean?

As another example of using computed subforms, I often do development of interfaces for both Notes and the Web. I’ve found it easier to separate the elements into a subform for each and compute the subform based on the client type.