Subject: RE: Changing values of check box
Okey dokey… I am working on the assumption that the following values need amending as follows:
CURRENT VALUE = Business Intelligence / NEW VALUE = Artificial Intelligence
CURRENT VALUE = Discrete Mathematics / NEW VALUE = Computer Graphics
CURRENT VALUE = Computer Arch / NEW VALUE = Discrete Algorithms
I am also assuming that the field name is SUBJECTS
I am also assumuing that you have already updated the values in the Field Properties > Choices section to be the new values.
As such, the following code should work in an agent:
FIELD Subjects:= @Replace( Subjects ; “Business Intelligence” ; “Artificial Intelligence” );
FIELD Subjects:= @Replace( Subjects ; “Discrete Mathematics” ; “Computer Graphics” );
FIELD Subjects:= @Replace( Subjects ; “Computer Arch” ; “Discrete Algorithms” );
SELECT @All
Points to note:
a) If the field type is a Checkbox, the code above will work. Checkboxes save data as text lists. If you use a different type of field, we might need to use @Explode in there, but try this first.
b) You ought to consider aliases in your checkboxes. For example, in the field properties you probably have something like this listed:
Artificial Intelligence
Computer Graphics
Discrete Algorithms
If you had aliases too, you would never need to change “old” value programatically. If you were to use:
Artificial Intelligence | 1
Computer Graphics | 2
Discrete Algorithms | 3
then the numeric values would be saved with docs. You could then edit form properties whenever you wanted, and change the values (“artificial intellegence” for example). The form would automatically display the “new” values. You might have to change a view column or two, but at least you’re not changing data on documents…)