cancel
Showing results for 
Search instead for 
Did you mean: 

Inheritance question related to attribute migration from child to parent

bog
Explorer
0 Kudos

Hi,

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.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

GeorgeMcGeachie
Active Contributor
0 Kudos

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
bog
Explorer
0 Kudos

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.

GeorgeMcGeachie
Active Contributor
0 Kudos

Looks like a useful bug (or is it an undocumented feature?)