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 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.

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:
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2007-04-26 - SvenDowideit
 
  • 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.