Question
Hello Twiki Community! We have a Table of Content page with a bunch of topics numbered by our various products. So every topic is like 1.x.x where the "1" is the the product in question. So far we have about four products and what we want to do is have a variable or something hold the number of topics under 1, 2, 3, 4, etc so we can display the number of topics made for each product as a statistic on the table of content page.
I have read through the documentation, and I'm having a hard time figuring out how to do this. Can anyone provide me with some suggestions or help? Thanks!
Ok, here is an example of our structure:
- Product #1
- Test 1 page link
- Test 2 page link
- Test 3 page link
- Test 4 page link
- Product #2
- Test 1 page link
- Test 2 page link
- Test 3 page link
- Product #3
We want to be able to know how many tests have been written, so
Product #1 would return 4, product #2 would return 3, Product #3 would return 1, and total tests would be 8. it goes by tests written so I suppose what I'm doing is line counting. I think the
ForEach plugin might be useful. Does this clarify what we're trying to do? Thanks for any help!
--
StevenShepherd - 17 Apr 2008
Environment
--
StevenShepherd - 29 Jan 2008
Answer
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.
Not sure I understand what you are trying to do.
Possible solution at
NumberedHeadings and
NumberedHeadingsWithNesting.
--
PeterThoeny - 02 Mar 2008
I'm not sure I understand either. Maybe you could provide a more detailed example?
But if you're trying to display a simple count of objects matching a search, then you use the
SpreadSheetPlugin
and do something like this:
- Find them (hidden):
<!-- %SEARCH{search="TOPICPARENT{name=\"%TOPIC%\"}" nonoise="on" format="$percntCALC{$SETM(topics, + 1)}$percnt"}% -->
- Then output the count:
%CALC{$GET(topics)}%
If you need a loop for different products, you could use the SpreadSheetPlugin for that too, or you might want to look at the
ForEachPlugin
and do something like this:
%FOR{"counta" start="1" stop="4" step="1"}% $counta %NEXT{"counta"}%
--
SeanCMorgan - 03 Mar 2008
It turns out you don't need the ForEachPlugin, just a
nested search and the SpreadSheetPlugin. Here's using one way to do it, using Plugins web as an example (I cut it off after 7 top level nodes):
1) Set the topic counts (this should be hidden, but HTML comment marks didn't work):
Show
Hide
2) Display with the topic counts:
You also wanted a grand total. That would be a separate count,
as per my response on 03 Mar 2008 (but searching where topic is like "..Test..")
--
SeanCMorgan - 21 Apr 2008
Thank you! That solves my problem! You guys are the best!
--
StevenShepherd - 13 May 2008