Reputation: 2030
In ibm Notes i have a document in which there is a field (for example price) when someone opens up the document, the field will be prefilled with data from somewhere else. So I made this field a 'computed field for display' but I want users to also let them edit the field, but this is not possible. So how can I make a computed field editable for users?
Upvotes: 1
Views: 1080
Reputation: 2497
It depends on why your field is computed for display.
Fields that are computed for display do not get written to disk, which means the formula is executed every time you open a doc, not just when you open a new doc or are refreshing/saving a doc that's being edited.
If that's your intent then you can't have any other field and will need a different, editable field to allow for a user to override that number. If your computed for display field was called ExamplePrice, what I'd probably do is
@If(ExamplePrice_Mode = ""; 0; @Return(ExamplePrice_Edit));
before the first line, or@If(ExamplePrice_Mode = "";
and ExamplePrice_Edit);
On the other hand, if it's okay if ExamplePrice doesn't change unless the document is edited and saved again, then you could still do it the above way, or you could get away with one less field by letting your ExamplePrice field be editable and then using an Input Enabled formula.
@If(ExamplePrice_Mode = ""; 0; @Return(@ThisValue));
before the first line, or@If(ExamplePrice_Mode = "";
and @ThisValue);
ExamplePrice_Mode != ""
Upvotes: 1
Reputation: 338
If you really want one field, you can make it work with help of form events, but it does not work when you need to show the latest 'price' when the document is opened again.
One way is to have 3 fields
Upvotes: 0
Reputation: 1641
The typical solution is to have two fields, one editable, hidden when document is open for reading and printing, and one computed for display, hidden when document is open for editing.
Upvotes: 1
Reputation: 22284
You could solve this a couple of ways.
First you have to think of the user experience. The same field will be both computed by default and editable when needed.
One way to make that happen is keep the field always computed and provide an edit button that launches a dialog popup to let you edit the value. Your computed formula would look for that overridden value and if it doesn't exist it would just do the calculation.
Another solution is to have it always editable and set the value when other fields change. The code for that would be placed on the fields used in the calculation.
There may be other ways to solve the problem and it is helpful to start with the user in mind.
Upvotes: 4