ClarisWorks: Replacing Data in a Database Field

This information was provided by Claris Corporation on 16 March 1998, and incorporated into Apple Computer's Tech Info Library.
FileMaker Pro has a Replace command to replace the contents of a field with new data for all records being browsed. However, since ClarisWorks 1.0 does not have a Replace command, you need to use a workaround. Here are three different methods to accomplish this.

EXAMPLE #1: Using a Macro
This method is good for auto-entering data into a blank field, or replacing the entire contents of a field with new data. (Note: ClarisWorks 2.0 adds auto-entry options features. See the TIP at the end of this article for more details.)

To define a macro to auto-enter or replace information, you must manually switch to each record, then replace the data in a field. Therefore, it's not practical to record a macro for more than about 5 to 10 records at a time. Nevertheless, if you need to replace the data in 100 records, its easier to record a macro that replaces the data in 10 records, then run the macro 9 times to replace the data in the remaining 90 records. Another disadvantage of this method is that it is not flexible. When a macro is recorded, it only handles replacing the data in a specific field with specific new data. Nevertheless, here is the technique to use:

Defining the Macro:
1. In Browse, go to the first record with the field you want to auto-enter the new data into. Click into this field.
2. Go to Macros in the File menu, then select Record Macro.
3. Give the macro a name and a keystroke, then click Record. (see Working with Macros in the ClarisWorks Handbook for more information)
4. Choose Select All in the Edit menu. DO NOT CLICK IN THE FIELD!
5. Type in the new data.
6. Choose Select All in the Edit menu., then choose Copy from the Edit menu.
7. Click the bottom page of the book in the Status Panel (Goes to the next record, leaving the cursor in the same field). Do NOT click in the next record to get there.
8. Choose Select All in the Edit menu..
9. Choose Paste from the Edit menu.
10. Repeat steps 7, 8 and 9 for as many records as you want to replace the data in (for a single macro).
11. To stop recording the macro, choose Stop Recording from the Macros sub-menu in the File menu.

Using the Macro:
1. In Browse, go to the first record with the field you want to auto-enter the new data into. Click into this field.
2. Run the macro. You can run this macro more than once to auto-enter into more records than are defined in the macro.


EXAMPLE 2: Using the Spreadsheet
This method involves moving the data to the spreadsheet, replacing the data in a column (field), then moving the data back to the database.
1. Be sure you're browsing only the records you want to auto-enter data into a field. You can use the Find command, or a combination of Match Records and Hide Unselected, or Show All Records to do this. Also, be sure you're in a layout that has ALL the text, number, date and time fields in your database.
2. Press the Enter key, or click on the white space of the layout (not in a field)
3. Choose Select All from the Edit menu
4. Choose Cut from the Edit menu
5. Choose New from the File menu. Create a new spreadsheet file
6. In the spreadsheet, choose Paste from the Edit menu. Your data is now Pasted into the spreadsheet
7. Click into the first cell in the column with the field data you want to replace or auto-enter.
8. Enter the new data, then press the Enter key.
9. Click on this cell again with the new data, then drag down to select all the cells in that column for all rows with data.
10. Choose Fill Down from the Calculate menu. The new auto-enter data will be entered into that column for all records (rows).
11. Choose Select All from the Edit menu.
12. Choose Copy from the Edit menu
13. Switch back to the database window (select the database file's name in the View menu). The database file's window will now be active.
14. Select Paste from the Edit. The records will be pasted back into the database.
15. Save.


EXAMPLE 3. Using Find/Change
Unlike the previously described examples, the Find/Change command can search and replace only part of the data in a field (say, a word or two), instead of completely replacing the field contents. This method cannot be used to auto-enter data into a blank field (you can't use Find/Change to search for a blank). See the ClarisWorks handbook for more information on Find/Change.

TIP: Since Find/Change searches and replaces data in ALL fields on your layout, create a layout that has only the field(s) on it that you want to Find/Change the data.

TIP: (ClarisWorks 2.0): ClarisWorks 2.0 can auto-enter data into a field when a new record is made. If you think you'll want to auto-enter data into this field later (after the record has been created), consider this: instead of leaving this field blank, auto-enter some unique value into this field when the record is defined (say, an X). Later, you could then use Find/Change to find the X and replace it with updated data.
Published Date: Feb 18, 2012