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

Andre Guirard submitted a great idea to the SearchDomino tool shed, a way to read/set document fields from view without writing a agent for each field you what to change.

He has code for R5 and R6, however I found I small boo boo in the R5 code in that

1
2
3
4
5
6
7
8
9
10
11
12
REM "Formula for R5";
choices := @DocFields;
fieldName := @Prompt([OkCancelEditCombo]; "Field Name"; "Enter FieldName."; ""; choices);
FIELD DUID := @text(@DocumentUniqueID);
oldValue := @GetDocField  (DUID;fieldname);

newValue := @Explode(@Prompt([OkCancelEdit]; "New Field Value"; "Please<br />enter new value (use ";" for multivalues -- don't put space after ;).";
@Implode(@Text(oldvalue); ";")); ";");

adjValue :=  @If(@IsNumber(oldValue); @TextToNumber(newValue);   @IsTime(oldValue); @TextToTime(newValue);   newValue);
@If(!@IsError(adjValue); @SetField(fieldName ; adjValue);
@Prompt([YesNo]; "Change field value"; "New value not of same type as old value. Set field to text?");@SetField(fieldName ; newValue);   "")

He had done

1
oldValue := @GetField(fieldname);

,but there is no @getField function in R5.0X. So I’ve attempted to correct this by using

1
FIELD DUID := @text(@DocumentUniqueID);<br />oldValue := @GetDocField  (DUID;fieldname);

Which now complies.

But I’m still not out of woods yet, Still not “working as expected”, since I’m not getting the old value.

On investigation I’m getting a “@SetDocField and @GetDocField cannot access the document currently being computed”. Frell!

It is a slick generic development tool, just needs some more work.

Leave a Reply