Relationship to same entity

Is it contemplated within the component to be able to import related records in the same entity that uses a self-incremental field as the primary key? example you have a group and a subgroup, where the subgroup must have a relation to the group within the same entity. A self-incremental primary key is used because the code of both the group and the subgroup can be the same. The difference is the type and therefore a constraint (code, type) is applied.

I tried importing with reference to its primary id but it always goes up null.

Regards

Nelson F.

Hi,

Ive never tried it actually. Do you mean you want to reference to entries that are already persited before the import or are do you want to reference to items of the same file?

The first option should work, the latter is problematic. It will only work if they are ordered and you set the import strategy to SINGLE_PER_ENTITY…

Or with a pre-commit script…

They are not elements of the same file, they are elements that have already been imported but that are related to the new elements that are going to be imported. When trying it does not work, simply the value is null.

Hi,

In this case i think it should work. Can you share an example with:

  • Example project
  • import configuration
  • import file

Bye
Mario