Use the Replace Field Contents function
Create a temp field.
FInd the 400 records.
Select the Temp field and replace with calculation of height field.
Select the height field and replace with calculation of width field.
Select the width field and replace with calculation of temp field.
Delete temp field.
or dont create a temp field and use variables in the script to do the switching
// create a found set as needed
Set var $h = height_field
Set Var $w = width_field
set field width_field = $h
set field height_field = $w
go to next record exit at last
Please have a look at this file with this script.
I would use that instead of the replace field, but most important: Make sure that you establish context and have the correct found set before doing it:-)
There are other ways of doing it, but you should take care to have a backup if the data is important.
switch_script.png 123.4 K
Thanks to all of you for replying so rapidly. I solved the problem by going back to the original data source in Excel, found the incorrect records, and switched the requisite columns and reimported them. Nevertheless, these are all great tips for future reference.
Bad advice here. Note that if you were to use the Replace Field Contents function as advised, the value of all 400 records would be reset to the same value you placed in your temp field. A looping script such as suggested by others is definitely the method to use.
Think of Replace Field Contents as a sledgehammer which will crunch everything at once, and whose results cannot be undone (FM warns you of this when you try).
I wouldn't script it at all. The replace field contents method allows you to step through each replace and verify the results before overwriting any information.
If did script it you just don't have to loop through all of the records and you will get the same results.
I end up with a field to delete. You end up with a script that you may want to delete.
And a simple typo in the script could lose the some data for all 400 records.
Yes, PM, se my advice from 8.20
the value of all 400 records would be reset to the same value you placed in your temp field
Actually, using replace with calculation would NOT set the same value in every record. It will set the temp field to the height field of each record.
Still, I prefer the looping method for this, too, for the rest of the reasons you describe.
Ahh, good point Chris. I overlooked that it was using a calc. Still, I'd avoid it nonetheless.
Replace is a very uncontrollable process, while a scripted approach is giving you the ability to check each par of the process.
In the example script I gave here you can add conditions in the loop = for each record handled. You can even add a result field or do logging of the changes done. And if the process is stopped you will via logging/result be able to resume from the right point.
Replace and other functions like it is pretty uncontrollable and if network connection breaks or other problems occur they may leave the database in an unknown state.
So, as Extensitech and other write: A scripted approach is preferable.
Btw. The problem was solved by deleting data and going back to original data, if I understand Jemiljan correct.