We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
Tags:
create new tag
, view all tags

Question

I am trying to spice up the standard "50 most recent changes" on my TWiki. Right now the search I have running is this:

%SEARCH{ "\.*" scope="topic" regex="on" nosearch="on" nototal="on" order="modified" reverse="on"  format="| [[$topic]] | $wikiusername  | $date |" limit="15" }%

However, I want the first thing printed (right now it's [[$topic]]) to actually have the content of a formfield to be the text displayed. Something like [[$topic][$formfield(DescriptiveName)]].

But, I also need this formfield to change, depending on the topic name. For instance, if the topic starts with "ComputerID", I want to grab a specific formfield. If the topic starts with "NetworkID", it needs to get a different formfield. And so on.

This way users see something very descriptive and relevant to them in the recent changes listing.

Any thoughts on how this might be done?

Environment

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

-- JasonLuttgens - 25 Apr 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.

A low hanging fruit solution is to simply list the form fields, one after the other, such as [[$topic][$formfield(DescriptiveName)$formfield(ComputerID)$formfield(NetworkID)]]. An empty string is returned if a form field does not exist. This approach assumes that the listed field names are not shared among the foms (otherwise you would get more than one form field value).

With the help of some SpreadSheetPlugin functions you can output text conditionally. Remember to escape the CALC so that it executes once for every hit, such as [[$topic][$percntCALC{$IF(..., $formfield(DescriptiveName), $IF(..., $formfield(ComputerID)))}$percnt]]. See $IF(), $EXACT(), etc.

-- PeterThoeny - 25 Apr 2007

Using calc with the IF conditionals worked out beautifully. Thanks Peter!

-- JasonLuttgens - 25 Apr 2007

one fewer open Q smile

-- SvenDowideit - 26 Apr 2007

 
Change status to:
Topic revision: r4 - 26 Apr 2007 - 11:19:05 - SvenDowideit
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback