We have a form of style Master → Details, where Details are shown in a “table view” form
Records of Details form are divided in two groups: Simple and Compound.
Compound ones are formed by one or more Simple records making a kind of block of parent and children, each child has the ID of its parent (parent_id)
Simple and Compounds records can be in the Details list at the same time.
Actually we have a routine wich moves records up and down in Details list, the way to do that is copy the content of a record to the next one.
The problem is with Compound records, because parent and children have to be moved as one, when doing this the rest of Simple record in a moment
pass through positions of Compound records taking ID of their parent, when movement is finish we try to clear parent_id of Simple moved record
but this doesn’t work, once it gets the parent_id it cannot be removed, neither assigning null nor any other value.
IDs are managed with “db identity” and autosave is set to false, at moment of saving we use startTransaction - commitTransaction.
Because of this, when working on moving Details, IDs have the form dbIdentValue123…, we don’t know if that affects on something.
In summary we have:
Master
- master_id
- info
Details
- detail_id
- master_id
- position
- info
- parent_id (for children of Compound records)
Notes:
- Simple records and parent of Compound records should have parent_id field set to null.
- To copy records we use databaseManager.copyMatchColums(srcRecord, destRecord) function.
- In other cases where Details have only Simple records they work perfectly.
We’d like to know if there’s a better way to do this, or if we can avoid that copyMatchColumns function copies a particular field and that field
will be copied manually in case of needed. We tried to do that with third function parameter set first in true, after with ‘parent_id’
an it still doesn’t work.