Q&D Action button to set Date Value with Lotus Notes Formula Language

A quick and dirty way for doing this. No error checking, big assumptions about the input to the prompt being right.

1
2
3
4
5
nd := @Prompt([OKCANCELEDIT]; "Enter the New Date"; "YYYY/MM/DD."; @Today);
@If (nd ="";@Return("");"");
y := @Left (nd;"/");
m := @Left(@Right (nd;"/");"/");
d:= @right(@Right (nd;"/");"/");
1
2
FIELD DateFieldOnForm := @Date(@TextToNumber (y) ;@TextToNumber ( m)
;@TextToNumber ( d) )

the Key is parsing the string with @lefts and such, and then TextTonumber, to put humpty Dumpty back together again. The @Date means it is a Date field on the document, not a text string.

The better, clean, way would be to use LotusScript and open a form in Dialog box mode, the form having a Calander tool on it.

4 Replies to “Q&D Action button to set Date Value with Lotus Notes Formula Language”

  1. I’m trying to use my own code and your code but neither seem to work in Domino 7. The @Today part is not working. Any ideas?

    FIELD date :=(@Prompt([OkCancelEdit]; “Enter implementation date”; “Format: MM/DD/YYYY. Ex: 10/01/2007”; @Today));

    and

    nd := @Prompt([OKCANCELEDIT]; “Enter the New Date”; “YYYY/MM/DD.”; @Today);
    @If (nd =””;@Return(“”);””);
    y := @Left (nd;”/”);
    m := @Left(@Right (nd;”/”);”/”);
    d:= @right(@Right (nd;”/”);”/”);

Leave a Reply