Tags:
create new tag
, view all tags

Question

I am trying to essentially create a dyanmic list by searching a bunch of topics, outputting the 'keyword' field and then I want to output the results in a table, but (and here is where I have the problem) listing ONLY unique entries.

So, for example, I have say a dozen pages, each based on a template with an attached form with a field called 'Keyword'. This is a freeform text field (which I eventually want to be a select list based on previous entries, but allowing new entries - hope this makes sense). So lets say 5 of the pages have a keyword of "email", 3 have a keyword of "backup" and the remaining 2 have a keyword of "misc". So I want to see output that looks like:

Keyword
email
backup
misc

What I have so far is

%CALC{$LISTUNIQUE(%$NOP()SEARCH{search="META:FIELD.*Keyword;" topic="KnowledgeBase*" nosearch="on" nototal="on" regex="on" noheader="on" format="|$formfield(Keyword)|"}$NOP()%)}%

however this does NOT generate a list of unique words - it simply extracts all of the keywords and presents them all to me.

All help would be appreciated - and if I'm going the completely wrong way about acheiving this, please put me straight!

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: RedHat? Enterprise Linux 5.1
Web server: Apache
Perl version:  
Client OS: Windows Xp
Web Browser: FireFox?
Categories: Search

-- JaneGianoutsos - 14 Apr 2008

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.

You are on the right track. The trick is to do a SEARCH that just feeds a CALC variable, then to do the unique function on the set of keywords found. Here is an example that searches the last 50 support questions and gets the unique SupportStatus form fields (for illustration; not a useful case since the possible values are already known). View raw to see how this works.

Status
AnsweredQuestions
AskedQuestions
ClosedUnanswered

-- PeterThoeny - 15 Apr 2008

You rock! Thank you so much. smile (I have lately become painfully addicted to Twiki, much to the amusement of my workmates!)

-- JaneGianoutsos - 15 Apr 2008

Or use %FORMATLIST% from FilterPlugin.

-- MichaelDaum - 15 Apr 2008

Awesome - cheers Michael - this works really well, especially given I ultimately wanted to use the resulting list in a select list - the calc option although pretty cool, adds a bundle of paragraph markers thus negating the usefulness in a select box.

-- JaneGianoutsos - 29 Apr 2008

You can do that also with a CALC:

-- PeterThoeny - 30 Apr 2008

Hmm. The learning continues! Thanks again!

-- JaneGianoutsos - 08 May 2008

 
Change status to:
Topic revision: r7 - 08 May 2008 - 23:09:34 - JaneGianoutsos
 
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