The replace statement maintains referential integrity between items that contain bidirectional bridges used by the Update processor by eliminating duplicate item-IDs.
replace file.var, item-ID.old with item-ID.new
file.var | File that contains the duplicate item-IDs |
item-ID.old | Item to be replaced with item-ID.new. |
item-ID.new | Item to replace item-ID.old. |
item-ID.new replaces item-ID.old in bridged-to items. item-ID.old is deleted after replacement. In order for the database to be consistent, there should be two-way bridges between the references.
Assume that two files exist with the data shown below. Both files contain a bridge to attribute 1 of the other file.
File1 | File2 | ||
---|---|---|---|
ID | Attr1 | ID | Attr1 |
b | 1 | 1 | b |
c | 2 | 2 | c |
d | 3 | 3 | d |
Now assume that this FlashBASIC or BASIC program is run:
open "file1" to f1 replace f1,"b" with "c"
Now, the files contain:
File1 | File2 | ||
---|---|---|---|
ID | Attr1 | ID | Attr1 |
c | 1]2 | 1 | c |
d | 3 | 2 | c |
3 | d |