Skip to Content

Inheritance question related to attribute migration from child to parent


I have a bunch of child entities in an LDM and I set-up inheritance to create a single parent entity (I have GenerateParent checked) that combines all the attributes from the children. There are a lot of common attributes and a few specific fields that made this pattern suitable in my scenario.

Now, the problem that I have is this. I want to add a new field called ContractCode in two of the children. The field is the same but it applies to only two child entities. When the attributes are copied to the parent, instead of having only one attribute, ContractCode, there are two ContractCode attributes added to the parent entity. PD renames the second ContractCode to something like Abc_ContractCode. I do not understand why PD doesn't create only one attribute.

Is there a way to get it to combine the two attributes into one at the parent level and have the attributes added in the child entities as well?

I know I can get away from this by adding the attribute only in one of the child entities, but I want the logical modal to reflect that this attribute applies to the second child entity. I tried to remove the inheritance relationships and add them back but PD keeps creating two attributes instead of combining them into one.


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Posted on May 09, 2019 at 07:43 PM

    ok, I found a hack. Deleting the attribute in the parent entity using the entity editor and then going to attributes doesn't work because the delete button is disabled when you select the attribute.

    However, I selected the attribute in the Diagram Editor (you have to click twice - not double-click - on the attribute), pressed Delete and presto the attribute was deleted from the parent while preserving the attribute in the child entity. I suspect this is a bug - the developers forgot to cover the deletion of attributes using this method.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on May 09, 2019 at 09:15 PM

    I'm not sure why you want to see all the child attributes in the parent entity - I prefer not to see unnecessarily duplicated attributes in a LDM, they can be confusing. The technically correct way to achieve what you want is to insert a middle level in the hierarchy where the ContractCode attribute lives, so you only need to define the attribute once. This may look untidy in the LDM, but it will generate exactly what you want in the PDM.

    If your final objective is to only generate the parent table in a PDM, there are a couple of other options.

    • use the Table Collapsing feature in the PDM to combine the tables after generating them
    • set the inheritance to generate both parent and child tables, to simplify the view of attributes in the LDM, then create a model transformation that you run while generating a PDM - it can copy child attributes up to the parent before generating the PDM
    Add comment
    10|10000 characters needed characters exceeded