Tags:
create new tag
, view all tags

Question

I want create a double-bracket link to a topic whose name is based on the current %TOPIC% name. But I only want the double bracket link if the destination topic already exists.

If the topic doesn't exist, then I want to display nothing.

For starters, just to get the CALC statement working correctly, I'm performing the test on if %TOPIC% itself exists.

The following attempts are coming up fruitless & I'm frustrated.....

%CALC{"$IF($EXISTS(%TOPIC%), [[%TOPIC%][this topic exists]], does not exist)"}%

%CALC{"$IF($EXISTS($perTOPIC$per), [[%TOPIC%][this topic exists]], does not exist)"}%

%CALC{"$IF($EXISTS($NOP(%)TOPIC$NOP(%)), [[%TOPIC%][this topic exists]], does not exist)"}%

Environment

TWiki version: unspecified
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Deployment

-- KeithHelfrich - 15 Jul 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

This is for my development of the QuickCheckListApp, where I want to link to =%TOPIC%ChecklistItemState ... but only if it exists already.

-- KeithHelfrich - 15 Jul 2007

Testing:

  1. $IF($EXISTS(DynamicDoubleBracketLink): this topic exists
  2. $IF($EXISTS(Support.DynamicDoubleBracketLink): this topic exists
  3. $IF($EXISTS(DoesNotExist): does not exist
  4. $IF($EXISTS(Support.DoesNotExist): does not exist

As you can see, a full web.topic name qualifier is needed. This is a bug that is fixed in the latest plugin. Upgrade to the latest plugin or use a full web.topic qualifier.

-- PeterThoeny - 15 Jul 2007

Thanks, Peter.

Using the web.topic qualifier works when the %CALC% is done inside of the topic itself. But when I try to place this same calc test in a CommentPlugin template, the result is a verbatim screen print of the calc command.

How can I do this if topic exists test inside of a CommentPlugin template ?

-- KeithHelfrich - 27 Jul 2007

I do not know. Seems like an inconsistency in the CommentPlugin.

-- PeterThoeny - 27 Jul 2007

OK, thanks. I have submitted Bugs:Item4423

-- KeithHelfrich - 27 Jul 2007

Setting to answered...

-- PeterThoeny - 29 Jul 2007

 
Change status to:
Topic revision: r6 - 2007-07-29 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, 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.