Tags:
create new tag
view all tags

Question

I have created a list of recently created topics, shown in reverse create date order. I can limit this by quantity but would like to limit it by date, eg to show all topics created within the last week.

Here is an example table:

%SEARCH{".*" web="%WEB%" type="regex" nosearch="on" noheader="on" order="created" limit="5" reverse="on" 
format="| $topic(25, ...) | !$parent(20, ...) | !$createwikiname | $rev | $date |" 
header="| *Topic* | *Parent topic* | *Created by* | *rev* | *rev date* |" }%

If I add date="P7d/$today" within the varSEARCH , this limits the list to topics edited in the last week, but not necessarily created, and shows them in created date order. ie. topics created several months ago but edited this week now appear.

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Linux 2.6.9-34.elsmp
Web server: Apache/2.2.2 (Fedora)
Perl version: 5.008008 (linux)
Client OS: MS Windows XP, 2002, service pack 2
Web Browser: IE 7.0.7530.11
Categories: Deployment

-- TamsinTweddell - 30 Jul 2007

Answer

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.

I've just noticed that under VarSEARCH (on twiki.org) the parameter createdate is defined, so in theory adding createdate="P7d/$today" should solve it. But createdate is not defined in TWiki-4.1.2 which I'm running.....even though the release notes on my system (TWikiReleaseNotes04x01) say "Add search by createdate option to SEARCH".

I guess I've answered my own question! Is there a simple way I can incorporate this functionality? Is there a single file I can update somewhere?

-- TamsinTweddell - 31 Jul 2007

$createdate is in 4.1.2 but you have read the doc wrong. You can show the date in a formatted search. You cannot use it as a search criteria.

-- KennethLavrsen - 31 Jul 2007

Kenneth. Thanks for your response. Does that mean that what I'm trying to do is not possible?

-- TamsinTweddell - 02 Aug 2007

%CALC{$SET(weekold, $TIMEADD($TIME(), -7, day))}% 
%SEARCH{ "." scope="topic" type="regex" nosearch="on" nototal="on" order="modified" reverse="on" format="$percntCALC{$IF($TIME($createdate) < $GET(weekold), <nop>, | [[$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }% 

-- KennethLavrsen - 03 Aug 2007

Kenneth - thanks that's great. Here's my version if anyone wants to use it. Orphaned topics are those with a ! in the Parents column:

Topics created within the last 30 days:

Topic Parent topic Created by rev create date

%CALC{$SET(weekold, $TIMEADD($TIME(), -30, day))}% 
%SEARCH{".*" type="regex" web="Blog" nnosearch="on" noheader="on" nototal="on" order="created" reverse="on" limit="100"
format="$percntCALC{$IF($TIME($createdate) < $GET(weekold), <nop>, | [[$web.$topic][$topic(30, ...)]] | !$parent | !$createwikiname | $rev | $createdate |)}$percnt" 
header="| *Topic* | *Parent topic* | *Created by* | *rev* | *create date* |" }%

-- TamsinTweddell - 06 Aug 2007

The order="created" option in above example has a performance issue if there are thousands of topics like in this Support web. I changed the example to use the Blog web instead, and to show 30 days instead of 7 days.

-- PeterThoeny - 2011-02-19

Change status to:
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2011-02-19 - PeterThoeny
 
  • 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.