1
votes

I'm trying to add the following value to a computed field:

var b = @Subset(@Unique(@DbColumn (@DbName(),"vwNrRegistru",1)),-1);

if (@Elements(b)<1){return 10001; }

else { return (b+1);}

But, I want the computed field to be binded to a datasource field:

<xp:text escape="true" id="computedField1" value="#{Contr.txt_nrcontractcv}">

I would use an inputText, but everytime I open the doc. for editing, the value increments, that's the reason I would like to go for a computed field. How can I achieve this?

2
Check if the binded value on the datasource already have a value. If not do the calculationFrank van der Linden
I was looking for a @ThisValue for XPages, but I couldn't find any working solution.Florin M.

2 Answers

0
votes

You want to take the value from an existing Notes field, then do some calculation on that, then display the result, right?

You might want to bind your comp. field to a scoped var. Then do the basic calculation beforePageLoad and put the result into the scoped var. You can easily control when the calculation takes place, e.g. only for new docs, or on specific times of day or whatever

0
votes

Create a inputText with style="display:none;", so that it is always rendered*, but never shown on the screen and a 'computed field' (text) that simply is equal to the value of the non-displayed field.

  • when they chose to label the value in properties as "Visible" they made a mistake. They really ought to have called it "Rendered" in the properties. It might also have been useful for them to have a "Displayed" property to allow you to control the display style, but that would have been mixing too many things.