Often, one is faced with a situation in which they need to dynamically create labels and fields on the Notes client...
Set the property - Render Passthru HTML in Notes. Then create two 'Computed for Display multivalue text fields.
1. LabelValues: All Labels that need to created. (could be a lookup from a view). Sample value: "Label1":"Label2":"Label3."
2. DataValues: All option Values that need to be present on the dropdown lists. These need to be concatenated with the labelvalues to identify them.
Create a Computed Text. Make this as passthru HTML and add the formula behind this as:
<<Begin Computed Text Formula>> tableRowPrefix := "<TR> <TD Width=50>"; tableCellFix := "</TD><TD>"; tableRowSuffix := "</TD></TR>"; tableConstruct := "<TABLE>"; tmpLabelValue := ""; tmpDataValue :=""; n := 1; @While(n <= @Elements(LabelValues); tmpLabelValue := LabelValues[n]; tableConstruct := tableConstruct + tableRowPrefix + tmpLabelValue; m:=1; tmpDataValue :=""; tableConstruct := tableConstruct + tableCellFix + "<Select Name=""+ tmpLabelValue+"">"; @While(m <= @Elements(DataValues); tmpDataValue :=@Right(DataValues [m];tmpLabelValue); @If(tmpDataValue="";""; tableConstruct := tableConstruct + "<OPTION>" + tmpDataValue + "</OPTION>"); tmpDataValue :=""; m:=m+1); tmpLabelValue := ""; tableConstruct := tableConstruct + tableRowSuffix; n := n + 1); tableConstruct := tableConstruct+ "</TABLE>"; tableConstruct <<End Computed Text Formula>>
This creates the dropdown "pseudo-fields" and dynamic table.
Next create an editable text field called "totalValue". This stores the labels and values of the "pseudo-fields" upon saving.
Next, to create a submit button for saving and closing the doc you can use:
Now when you submit the document the dynamically created fields are not saved, but their labels and values are inside the totalValue field as: "(Label1 - Data2)(Label2 - Data3)(Label3 - Data3)."
Possibly, you could even have the individual fields created with onUnload event by setting the field values, or even create a computed field with the appropriate HTML to display these values when the document is next opened. As programmers sometimes say, "We can do anything as long as we have the data!"
Hope you like this!
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Sandeep Goyal. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.