Set field value/type via 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)) )

This was first published in September 2001

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.