This Blog has moved to http://www.falsepositives.com/

False Positives Adventures in Technology, SciFi and Culture from Toronto

Thursday, June 24, 2004

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


REM "Formula for R5";
choices := @DocFields;
fieldName := @Prompt([OkCancelEditCombo]; "Field Name"; "Enter Field
Name."; ""; choices);
FIELD DUID := @text(@DocumentUniqueID);
oldValue := @GetDocField (DUID;fieldname);

newValue := @Explode(@Prompt([OkCancelEdit]; "New Field Value"; "Please
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 oldValue := @GetField(fieldname); ,but there is no @getField function in R5.0X. So I've attempted to correct this by using
FIELD DUID := @text(@DocumentUniqueID);
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.


Please Note that this Blog (False Positives) has moved to http://www.falsepositives.com/

0 Comments:

Post a Comment

<< Home