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

Posted on 2005-04-06
Last Modified: 2013-12-18
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.

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

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 , False)
Question by:Enrique040897
    LVL 1

    Accepted Solution

    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)

    Author Comment

    Is there any room for a comment?  Your solution works fine, but not in Date/Time fields.  Please assist.
    LVL 1

    Expert Comment

    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.

    Author Comment

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    This is an old article, please see an updated version of this article, located here:
    Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now