Text Editor Copies, Replaces Data

I’ve noticed this happening over the years, but since it was erratic, I never tracked it down.
I have a form for data input with lots of text editor objects. I’ve discovered that if I activate a field (Field B) on a record and then run the following procedure:

Field «A»
sortup

The data in Field B in the original record is copied to Field B in the first record.

I’m guessing just turning the active field off first in the procedure solves the problem, but is that the expected result of running a sort with an active Text Editor Object?

It’s hard to say what the expected behavior is. Sorting will quite likely make a different record the active record. It will be whichever record becomes the first record after the sort.

When you open a text editor for editing, the text or number or date in the field is loaded into the text editor in a different format than the one that is stored in the field. It’s possible that the text in the object simply remains while the database is being sorted, and the active record changes. When you then close the object, its content then gets entered into the field, and that is when the data is replaced.

If this behavior can be confirmed, that should probably count as a bug. I think Panorama should either close the object automatically before sorting, or treat that as an error, and stop the procedure with an error alert.

I haven’t tried to duplicate this problem, so I can’t confirm it. But I can tell you that you can put a closeactiveobject statement at the top of your procedure to make sure that there is no active object before the code continues.

That said, I would have to say that statements like field and sortup should do this automatically. I’ve set up a bug report for this.