unid:= @Text(@DocumentUniqueID);
theField := @Prompt([OkCancelList]; "Change Field";
"Select Field"; @Environment("theField"); ""
DocFields);
@If(theField="";@Do(val:=@Prompt([OkCancelEdit]; "New Field"; "New Name:"; "");@If(@Trim(val)!="";@Eval("FIELD "+val+":=\"\";");""));"");
@If(val!="";@Set("theField";val);"");
@Environment("theField";theField);
currValueTemp:= @If( @IsAvailable(theField); @GetDocField(unid; theField);
"errorTemp" );
currValue:= @If( @IsError(currValueTemp); "errorValue"; @Text(currValueTemp) );
theValue := @Prompt([OkCancelEdit]; "Change Field"; "New Value: use semicolon separator for lists."; currValue);
@If(theValue = "@Delete"; @Do(@SetField(theField; @DeleteField);@Return(0));"");
currType:= @If( @IsNumber(currValueTemp); "Number";
@IsTime(currValueTemp); "Time"; "Text" );
theType := @Prompt([OkCancelList]; "Change Field";
"Data Type"; currType; "Text" : "Time" : "Number" : "Text List" : "Number List" :
"Time List");
@If(
theType = "Time";
@SetField(theField; @TextToTime(theValue));
theType = "Number";
@SetField(thefield; @TextToNumber(theValue));
theType = "Text List";
@SetField(theField; @Trim(@Explode(theValue;";")));
theType = "Number List";
@SetField(theField; @TextToNumber(@Explode(@Trim(@ReplaceSubstring
(theValue;" ";""));";")));
theType = "Time List";
@SetField(theField; @TextToTime(@Explode(theValue;";")));
@SetField(theField; @Text(theValue))
)