SID-02033: Number of Topics below Parent-Topic
| Status: |
Answered |
TWiki version: |
6.0.0 |
Perl version: |
|
| Category: |
CategorySearch |
Server OS: |
|
Last update: |
10 years ago |
Hey,
I'm searching for a way to get the number of topics below one parent topic AND all those topics below these topics and so on.
%SEARCH{ "META\:TOPICPARENT.*\"Hardware\"" type="regex"}%
does get me the Children of "Hardware" and the Number, but it just stops there and I don't have a way to get the children of the children...
Thanks for your help.
--
Martin Thieme - 2015-03-11
Discussion and Answer
You could do a nested search, see example in
FormattedSearch. However, this can be slow. For example if a topic has 20 children you would do 21 searches.
For better performance you could do a formatted search that creates a
SpreadSheetPlugin hash to store all topic's parent, then recursively traverse the hash to compose the list of children, children's children, etc. See blog
Advanced TWiki Spreadsheet Formulas: Power and Flexibility - Not For Grandma for inspiration.
Finally, you could install the
TreePlugin. It can list all descendants in a tree.
--
Peter Thoeny - 2015-03-13
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
Peter Thoeny - 2015-12-03
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.