Update on Lotus Formula Language > Developer tool: read/set document fields from view

An Update on a a bug in a otherwise very power (developer or Adminisrator only) tool for Lotus Notes / Domino noted Last week.

Now just a set document fields from view Tool.

Had a friendly email exchange with Mr Andre Guirard, with regards to the small bo bo (it give it it’s techical name). Here’s his updated code for R5 that does as much as is possible in the old version:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
_choices := @DocFields;

_fieldName := @Prompt([OkCancelEditCombo]; "Field Name"; "Select Field Name."; ""; _choices);

_newValue := @Prompt([OkCancelEdit]; "New Value - " + _fieldName; "New value (use leading # for number fields, [ for dates, ~ for strings. Separate multivalues with ; (no space) )."; "");

_firstchar := @Left(_newValue; 1);

_fixNew := @Explode(@If(firstChar = "~":"#":"["; _newValue; @RightBack(_newValue; 1)); ";"; 1);

_adjValue :=

@If(_firstChar = "#"; @TextToNumber(_fixNew);

_firstChar = "["; @TextToTime(_fixNew);

_fixNew);

@If(@IsError(_adjValue);

@Prompt([Ok]; "Change field value"; "Conversion error!");

_newValue = "@DEL";

@SetField(_fieldName ; @Unavailable);

@SetField(_fieldName ; _adjValue)

)

Note the change doesn’t always display in the Document Properties dialog right away.

Andre also comments that It not possible in R5 to detect the old type of the field and set the new value to the same type.

To use this formula, type # before a number value, [ before a date value, or ~ before a string. @DEL can be used to delete an item (I hope!). If you don’t use a prefix character the formula will assume you mean a string. Use ; as multivalue separator. So for instance, type #14;9 to set the item to a number list containing the values 14 and 9. If you type ~14;9 or 14;9 you will set the field to a text list containing the string values “14” and “9”.

Thanks again Andre!

Leave a Reply