April 24, 2006

Change field values in a document

I read about a tip by Thomas Adrian on notessidan.se on how to review fields in a document in a smart way.

I have a similar thing but less informative. Use it to view field information but also to change the value of a chosen field. It comes very handy to use when I need to change a field that is not in edit mode (compose), for example when I need to change the roaming subdirectory for a user in a person document. In the figure below I can type in a category where the marker is and press OK. The value of the field will change. Remember that sometimes you have to be in edit mode for the change to occur.



Here's the code:

  1. Add a new button in File -> preferences -> toolbar preferences
  2. Paste the following formula code

    choices := @DocFields;
    fullChoices := @Transform(choices; "x"; x + " = "+ @Implode(@Text(@GetField (x)); ";"));
    selField := @Prompt([OkCancelEditCombo]; "Field Name"; "Pick a field:"; ""; FullChoices);
    fieldName := @Left(selField; " = ");
    fieldValue := @Right(selField;" = ");
    @SetField(fieldName;fieldValue)


    It should look like this:






    Technorati tags: ,



No comments: