Computed Subform on an Xpage

  • I’m fixing to web enable an application that’s been pure Notes since 4.6, and they’ve actually agreed to up to R8.5 so I can use the latest toys for that effort. Those latest toys appear to be Xpages.- The current system uses Computed Subforms rather extensively to allow one Form to display and edit numerous types of documents that share maybe 90% of their fields. My searching of the web shows that subforms in general are supported with Xpages, but one has to manually enter field information. I’ve found not one single reference to computed subforms and Xpages, on the 'net or here on the Forum.

  • Is this dynamic field presentation even possible with Xpages? If so, and computed subforms aren’t The Way, what mechanism does one use? I could create a separate Form for each possible permutation of Subforms, but that seems like too big a step backward to be the correct solution.

  • Thanks for your time…

Subject: Computed Subforms, Custom Controls and Computed Data Sources,

Hi David

Sounds like this is a prime candidate for the power of custom controls. Although most things in XPages can be computed, I haven’t found a way to insert a specific custom control based on a computed formula.

However, what you could do is creat a custom control for the 90% of fields that are the same. The syntax for binding is then

value = “#{dataSourceName.itemName}”

So if your datasource always has the default name “document1” and you’re wanting to bnd to a field called “Title”, the syntax would be:

value = “{document1.Title}”

This just needs adding as an extra attribute of the xp:text - look at the source code for a computed field that has been explicitly bound to see what I mean.

You should then be able to create an XPage for each form, linking the datasource to the relevant form at the XPage level. You can then insert your single custom control, and add in any form-specific fields.

You could have additional custom controls for other fields which have the same name, getting as complicated as you want to minimise duplication of effort.

Hope this helps, and once mastered, you should be able to extend the same theory.

Regards

Paul

Subject: Had to read it a couple of times, but I think I get it…

  • Thanks, Paul! I’ll give that a go once I’m up to speed on XPages at all. Interacting with them in DDE is considerably less intuitive than I expected, but once one knows the vaguarities of how it’s done, it all seems sensible enough, and XPages do come across as mind-numbingly flexible. Woot!!..