This command is used when you want to replace the contents of some field with some expression while not editing this field directly.
In the Replace dialog box you have to choose the field name, scope of replacement (by default only the current record will be affected, but you may specify ALL for all records or enter the starting and optionally the last record to replace, e.g. "3-" for all records starting with 3 or "3-15" for records from 3 to 15); you may also specify the condition of replacement (e.g. "s" $ proto will mean that only the records where the field PROTO contains the letter "s" will be affected). Finally you must enter the replacing expression. This must be any valid xBase expression, e.g. a name of some other field in this database, or a constant, function or variable. For example, in the above case if you specify Upper(PROTO) the field PROTO will be all replaced by its former content in uppercase.
Since Star4Win 1.0.7 the Replace option of the Assist menu has been enhanced. Instead of just one field you can replace a range of fields by any chosen expression.
A field range can be specified by enumerating field names or their
numbers delimited by "-" and ",". Thus, in a database with fields
NUMBER, PROTO, GREEK, RUSSIAN, NOTES valid field ranges will be:
1, 2, 3 (= NUMBER, PROTO, GREEK)
1-4 (= NUMBER, PROTO, GREEK, RUSSIAN)
NUMBER-NOTES (= NUMBER, PROTO, GREEK, RUSSIAN, NOTES)
NUMBER, NOTES ( = NUMBER, NOTES) etc.
Any number above the overall number of fields will be truncated: e. g.,
for the above database the range 1-20 will be equivalent to
1-5.
To facilitate the work with field ranges a new function
FIELDNO() is
introduced, which returns the number of the field within the field
range. Thus, if you replace the field range PROTO, NOTES with
"Upper(getfield(fieldno()))" or "upper(getfield())" the contents of
both PROTO and NOTES will be changed to uppercase. Note that the call
"getfield()" without parameters is equivalent to
"getfield(fieldno())".
Type errors are frequent during REPLACE. For example, if you will try to replace the field range 1-5 with the expression "Upper(getfield())", an error will occur when the system will try to replace numeric NUMBER with "Upper(NUMBER)". To avoid it, the Replace dialog box now has an option Suppress errors. If it will be switched on, no error will be generated and the field NUMBER will just stay intact, while the other fields will be changed to uppercase.
Please remember that all REPLACE operations are not undoable, and make sure you have backed up your database before REPLACEing!