“Copy to Table” Statement Execution in Dexterity
I have been using Dexterity for a long time and find it very easy to learn and powerful for the purposes it was designed for.
Just to make life of Dexterity developers interesting, from time to time you may experience some odd code behavior. In order to overcome such cases, I recommend as much advanced debugging as possible in any situation. A few days ago I faced a problem with the “copy to table” statement.
“copy to table” and “copy from table” are recommended for usage for a variety of reasons. The most important reasons are a more readable code and compatibility with Modifier (if you copy field by field and someone extends that window through the Modifier, the new fields will not be saved nor read).
But, with the “copy to table” statement, I run into the situation where key fields of a targeted table were not copied into the table buffer even if they had an AutoCopy flag equal to true. That lead to the malfunctioning of the form which was saving all data into the same records with key values empty.
The cause of this problem is that the form had more than one window with those key fields and on each window those fields have AutoCopy flag set to true.
There are two solutions
• To set AutoCopy flag for all repetitive fields to false on all windows but one
• Explicitly define source window through command “copy from window XYZ to table AAA” (I prefer this solution)
Tags: "copy to table", dexterity