Data Being Added Conflicts with Existing Data

While developing a page with multiple scrolls levels, and especially when using a grid, you may get the error:

Data being added conflicts with existing data. (18,2).


This indicates a problem with the key structures in the tables in your lower scroll levels.

For example, you may have a parent record at scroll 0 with the keys: INSTITUTION and EFFDT, and then a child record at scroll 1 with the same keys INSTITUTION and EFFDT. That is, no additional key(s) to indicate the child data. If you are building a parent-child relationship, child records should have more keys than parent records, otherwise you have a design flaw.

A tell-tale sign of this in a grid, is that when you add another row in your grid all data is copied automatically to the new row. Check your child record (the one in your lower scroll level or grid) and examine the key structures, are you missing one or more keys?

Also check your overall page levels, do you have the scroll levels at the right occurs level? For example, have you accidently put a child record at the same level or higher than its parent? Remember scroll level hierarchy starts at 0 and goes up (1,2,3) so by higher I mean a child record with a lower or equal scroll level value as its parent. Be sure to fix up the occurs level in your scroll bar, scroll area or grid.

This error may also be happening because keys are not propagating correctly from parent to child records. Check the rows in your child record and ensure that it has the same high level keys as its parents. This is particularly common with the OPRID and RUN_CNTL_ID fields when working with run control records.

Another cause may be PeopleCode that modifies your key fields. For example, do you set a key field's value on FieldDefault, and then modify it later, say on SavePreChange causing a buffer mismatch?

No Comments
Back to top