Home | Blog Roll |  Link Roll |  Colophon/About| |


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

Posted under Show-n-Tell+Thursday, Lotus Domino, on Thursday, October 12th, 2006;

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

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;"/");"/");

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.

See also

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

  1. Sean Burgess Says:

    You could always use tmp := @Explode(nd;”/”) and then subscripts on the tmp variable to make the code alittle more compact.

    Sean—

  2. Scott Says:

    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


Close
  • Social Web
  • E-mail
E-mail It