The following code can be added to a view action button or, for
developers/administrators, to a smarticon. The code allows the user to select
any field on a document (within a view) and change the value(s) for the field.
It then prompts for a datatype to ensure the appropriate field datatype is
applied. This is very useful for changing hidden field values for example.
List := @DocFields;
DataTypes := "Text" : "Date" : "Number" ;
EditField := @Prompt( [OKCANCELLIST] ; "Select a field to alter" ; "Select the
field you wish to alter:" ; "CustomerReply" ; List ) ;
Edit := @Prompt( [YESNO] ; "Confirm" ; "Are you sure you want to alter the
current contents of field \"" + EditField + "\"." );
RawValue := @If( Edit = 1 ; @Prompt( [OKCANCELEDIT] ; "New Value" ; "Please
enter the new desired value." ; NULL ) ; @Return(NULL) );
DataType := @Prompt( [OKCANCELLIST] ; "Data Type" ; "Please Select the correct
DataType" ; "Text" ; DataTypes );
@If( DataType = "Date" ; @SetField( EditField ; @TextToTime( RawValue )) ;
DataType = "Number" ; @SetField( EditField ; @TextToNumber( RawValue )) ;
@SetField( EditField ; RawValue ) );
""
This was first published in November 2000