Tags:
create new tag
, view all tags

Question

Hi again!

I have some topics named like this:

  • ThisIsTopic2004x45
  • ThisIsTopic2004x46

Where 2004 is the current year and 45 and 46 is the week of the year.

Now, I'd like to %SEARCH% the topics with the current week in the current year. I have already patched the SpreadSheetPlugin to replace $weekofyear by the current week of the year (Date::Calc did the job), so that's not a problem anymore. My search first looked like this:

%SEARCH{search="Weekly.*%CALC{"$FORMATTIME($NOW,$weekofyear)"}%" type="regex" scope="topic" format="   * $topic"}%

I soon found that %SEARCH% wanted to close itself after the first occurence of }%, so I tried to set a custom variable:

   * Set WEEK = %CALC{"$FORMATTIME($NOW,$weekofyear)"}%

%SEARCH{search="Weekly.*%WEEK%" type="regex" scope="topic" format="   * $topic"}%

The result is exactly the same :-/. It looks like $weekofyear doesn't get expanded before the %CALC% thing takes place.

Is there a way to solve that?

Thanks a lot

André

Environment

TWiki version: Quite a recent one, doesn't really matter
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: irrelevant
Web server: irrelevant
Perl version: irrelevant
Client OS: irrelevant
Web Browser: irrelevant
Categories: Search

-- AndreBonhote - 08 Nov 2004

Answer

You hit a rendering order issue. SEARCH executes before CALC, you need the reverse. See related CollectingInformationOnUserPages. Your CALC needs to construct the SEARCH:

%CALC{$percntSEARCH{search=\"Weekly.*$FORMATTIME($NOW,$weekofyear)\" type=\"regex\" scope=\"topic\" format=\"   * $topic\"}$percnt}%

-- PeterThoeny - 09 Nov 2004

 
Topic revision: r2 - 2004-11-09 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by PerlIdeas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.