Tags:
create new tag
view all tags

SID-00830: Using '%INCLUDE' to combine tables from different topics

Status: Answered Answered TWiki version: 4.3.2 Perl version: 5.008008 (linux)
Category: CategoryRendering Server OS: Linux 2.6.18-53.1.14.el5pae (i386-linux-thread-multi) Last update: 16 years ago

Hi Guys,

I have a fairly specific user requirement which I've been having trouble with and I'm not sure if it's possible to achieve in TWiki.

The user maintains tables (to-do lists) on different topic pages depending on the project. Each table has the exact same columns and tracks things like start & end date, status, etc. so these can be sorted on.

The manager would like a topic page where all the to-do lists from the different topics are combined into a single table, so sorting can be done globally across all the to-do entries from the different projects. I.e. they want to be able to see a single list containing all to-do entries and be able to sort across all of it.

I've tried to use the '%INCLUDE' statement, and it works to pull in the tables, but it inserts them separately and not as a single continuous table.

As an example, I've created the following two topics containing tables:
- http://www.chaosworld.com/wiki/bin/view/Sandbox/TableExample1
- http://www.chaosworld.com/wiki/bin/view/Sandbox/TableExample2

..and have combined them on the following topic:
- http://www.chaosworld.com/wiki/bin/view/Sandbox/TableMerge

In the 'Table Example 1 & 2' topics I use anchors to denote the start and end of the table I'm including, and using that as the start and end markers in my '%INCLUDE' regex's. The two includes are pasted below as a reference and, as you can see, I've tried to put them side by side in an effort to make them into a single table (I've also removed the table headers in the 2nd table through the regex).


%INCLUDE{"TableExample1" pattern="^.*#TableStart(.*?)#TableEnd.*"}%%INCLUDE{"TableExample1" pattern="^.*\| \*Start Date\* \| \*Task\* \| \*Assigned To\* \| \*Status\* \| \*End Date\* \|(.*?)#TableEnd.*"}%

Q: Is there any way to combine these separate tables into a single table?

Thanks very much in advance for any help - much appreciated!

PS: At this stage I only have the base installation with no additional Plug-ins installed. Also, wasn't 100% sure about how to Categorise this question - hope the one I chose makes sense.

-- JanRoos - 2010-05-10

Discussion and Answer

Look into TWikiForms based applications with FormattedSearch and QuerySearch. Each project page would have a form attached; it is easy to run reports to pull data from the forms.

In your case the newline between the #anchors and table result in separate tables when you include them. As a workaround you can use a multiple="on" search with type="regex" to pull just the table rows from a page. Untested example:

%SEARCH{
 search="^ *\|.*\| *$"
 type="regex"
 topic="TableExample*"
 multiple="on"
 nonoise="on"
 format="$text"
}%

This will pull in all table rows. You can restrict it, for example to first column starting with a digit:

%SEARCH{
 search="^ *\| *[0-9].*\| *$"
 ...

More at VarSEARCH, FormattedSearch, RegularExpression

-- PeterThoeny - 2010-05-10

Peter,

Thanks a lot - that works an absolute treat! I never even considered using %SEARCH for this. I'll delve into the topics you've suggested.

I've got it up and running - client is super happy.

Cheers Jan

-- JanRoos - 2010-05-10

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title Using '%INCLUDE' to combine tables from different topics
SupportCategory CategoryRendering
TWiki version 4.3.2
Server OS Linux 2.6.18-53.1.14.el5pae (i386-linux-thread-multi)
Web server Apache
Perl version 5.008008 (linux)
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2010-05-10 - JanRoos
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.