Parent/Child Folder Entity (self loop) - how to list root folders (with no parent) with XPath

1
Hi all,   I have a Folder entity that has an association to itself (in a database table, I would have a ParentFolderId property pointing to the FolderId property in the table). I want to list all the root folders (with ParentFolderId = null), but I can't seem to be able to do this with XPath. If I do not(Association), it shows me only the folders with no association. But if a root folder has a child, then it has an association and it doesn't show. I'm assuming there's an easy way to do this and I am just not seeing it.   Many thanks Gonçalo
asked
2 answers
2

Goncalo,

I'm not sure if you already ran into this (or ever will), but working with self-references is a bit different from working with normal associations. From the name of your association, I assume you try to use this self-reference to point to the child folder from the parent folder and a parent can have multiple child folders, but every child folder references to one parent folder (many-to-one or Reference Default).

If you would make a page with one parent folder and you would want to show the child folders over this association, you wouldn't be able to with Data source Type Association. You would need to retrieve the child folders with this Xpath:

[MyProj.ParentFolder_ChildFolder = '[%CurrentObject%]']

 

Good luck with your project!

answered
1

Like I thought, it was something simple. 

"[not(MyProj.ParentFolder_ChildFolder/MyProj.Folder)]"

answered