Duplicate items in treeview widget

I am using the appstore treeview and datagrid widget to display a tree. Just like in the documentation for order and orderlines, I have a child linking back to the parent (association owner is parent). Only,now it shows duplicates: each child is linked to itself as well, so the tree looks like: > Parent A > Child 1 > Child 1 > ChildofChild1 X > ChildofChild1 X > ChildofChild1 Y > Child 2 ... > Child 3 How can I prevent the duplicates to appear?
1 answers

The only reason why you would see duplicates in the tree would be because your object "ChildofChild1 X" actually has the reference set to itself.

The treeview doesn't automatically set or interpret references, I had built a different structure with self-references and was able to show that without any problems.

Why would you want to have an association literally to the same object, in other words why would "ChildofChild1 X" have a reference to "ChildofChild1 X" (itself)?
From a functional perspective I think you should first look at that and see if that is correct, and solve that problem.

If for some reason you want to have that relationship you could try and influence duplicates with an xpath constraint. But I do not know how the platform interprets this with a self-reference.

   [not( id = module.Child_ChildRef/module.Child/id)]