• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

How to assign a value to a computed field, using a button?

Below are two examples of what I want (formula and lotuscript).  Both examples work fine.  The problem is that I have to do it using a button.  If the fields are editable, the button assign the values very well.  But if the fields are computed, after I click the button, the system assigns the values, but if you refresh or save the document, the values dissapear.  Please assist.

Enrique.
__________________________________
Using formula:
FIELD Programa := @Now;
FIELD trabajado_por_P :=  @Name([CN];@UserName);
FIELD F_programa_flag := "Si";
 @All

Using Lotusscript
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim session As New NotesSession
Dim userName As New NotesName(session.UserName)
Dim dateTime As New NotesDateTime( "" )
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document

Call dateTime.SetNow
Set doc.Programa = dateTime
Call doc.replaceitemvalue( "F_programa_flag" ,  "Si"  )
Call doc.replaceitemvalue( "trabajado_por_P" ,  userName.Common  )
Call doc.replaceitemvalue( "F_programa_flag" ,  "Si"  )
Call doc.save(True , False)
0
Enrique040897
Asked:
Enrique040897
  • 2
  • 2
1 Solution
 
pbagCommented:
The formula for the computed field will always get evaluated on refresh or saving. Since you want the value to be put by the action button better make the field as computed when composed.

Or other way will be having the field as computed but the formula like @if(Programa="";Formula;Programa)
0
 
Enrique040897Author Commented:
Is there any room for a comment?  Your solution works fine, but not in Date/Time fields.  Please assist.
0
 
pbagCommented:
For date time field too it would work only, but u need to take care of 2 things

1. The Formula that you put in the field should compute to a valid date/time
2. While setting the value from the action button you need to ensure that its in a date/time format.
0
 
Enrique040897Author Commented:
Both points are valid.  If I change the field to Editable, the action button changes the date (with a valid format) and I am able to save the document without problems.  But if the field is in computed or computed when composed, the system does not commit the change to the field when refresh.   Please assist.

Enrique.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now