Set field value/type via smart icon
Here's how to set the field values and types via use of the Smart Icon.
It can be frustrating to try to test a new document, then realize that a status field is set incorrectly. Or you may want to re-use a document that has a key field set to a different data type. This smart icon allows you to set both field value and/or data type on the fly. It covers all data types and allows changes to single or multiple value fields.
REM "SmartIcon formula for arbitrary alteration of a field"; theField := @Prompt([OKCANCELLIST]; "Change Field"; "Select Field"; ""; "":@DocFields); theValue := @Prompt([OKCANCELEDIT]; "Change Field"; "New Value: use
semicolon separator for lists."; ""); theType := @Prompt([OKCANCELLIST]; "Change Field"; "Data
Type"; "Text"; "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)) )