naio Posted July 11, 2012 Posted July 11, 2012 I want to build a multi-level tree structure with a single table, where every child has just one parent. The table is fairly simple and I call it 'nodes', it has the following fields: IDnode IDparent nodeName path (a calculation that should show the whole path from the tree root node) Root nodes will point to an IDparent valued 0. I create a second instance of this table called 'parents' and a relationship between both tables: nodes::IDparent = parents::IDnode Then I write the following calculation in the path field: If (IDparent=0; node; parents::path & ">" & nodeName) I have been able to do this with previous versions of FMP but now, under FMPA 11 I cannot. Is something wrong with this approach? is it possible that it worked before 11? how can I get it right (without lookup fields and scripting) The answers I found so far are very complex and I am sure I was able to make it work before... Thank you in advance.
mr_vodka Posted July 13, 2012 Posted July 13, 2012 Perhaps this can get you started. http://jonathanstark.com/archive/recursive-data-structures.php
naio Posted July 15, 2012 Author Posted July 15, 2012 Thank you very much for the in-depth article you point to, it's very interesting, however the problem I find is with displaying a 'path', as if I would like to display all the names between employee x and the CEO. The question is how can I build a calculation able to display the whole path of names between any employee and the CEO? Any additional help will be welcome...
eos Posted July 15, 2012 Posted July 15, 2012 The path would consist of the individual's path to the next higher level (if there is one), plus that one's path (ditto); sort of poor man's recursion.
naio Posted July 21, 2012 Author Posted July 21, 2012 thank you eos, this is what I meant, now it works
Recommended Posts
This topic is 4898 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now