Tags:
create new tag
view all tags

Question

This should be a really simple thing, but i can't figure out how to do it :| Nor can i find any reference to what i'm looking for.

i'm using a SEARCH to find all topics with a specifed attribute, which is working fine, but all i want search to return is a single number like "2", not "Number of topics: 2" for example.

The reason is that i want to put this information in a table and then do math and such on it.

so for example i'm entering

Proposed [My Search command to return all proposed]
Approved [My Search command to return all approved]

and want it to return something

Proposed 2
Approved 6

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Windows Server 2003
Web server: IIS 6.0
Perl version: 5.6.1
Client OS: Windows XP
Web Browser: FireFox 1.0.1
Categories: Search

-- BrentTokarchuk - 03 Mar 2005

Answer

Use a SpreadSheetPlugin variable in a FormattedSearch. Steps:

  1. Initialize a CALC variable
  2. Do search; format just increases the variable by one
  3. Use the result in tables etc

Untested example:

%CALC{$SET(total,0)}%
%SEARCH{ "something" nosearch="on" nototal="on" format="$percntCALC{$SETM(total,+1)}$percnt" }%
%CALC{$GET(total)}%

-- PeterThoeny - 06 Apr 2005

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2005-04-06 - PeterThoeny
 
  • 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-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.