Tags:
create new tag
view all tags

Question

I have been searching for quite some time on how I can omit a heading IF there are no search results for that heading.

My search pattern:

<table>
%SEARCH{"%META:APPROVAL.*state=\"ANALYSIS\"" type="regex" topic="SprId*" nototal="on" nosearch="on" header="| <tr><h3>SPRs Under Analysis |||||| </h3></tr><tr> | *ID* | *Title*  | *Date Created* | *Created By* | *Severity* | *Assigned To* |</tr>|" format="| [[SprId$formfield(ID)][$formfield(ID)]] | $formfield(Title) | $formfield(DateCreated) | $formfield(CreatedBy) | $formfield(Severity) | $formfield(AssignedTo) |" }%
</table>

I have added the html tags that do work, but the headers are not picked up in the %TOC%.

Is there a way to modify my search to show only the heading with results and also have it show in the %TOC%?

Sharon

Environment

TWiki version: TWikiRelease04x00x04
TWiki plugins: DefaultPlugin, SpreadSheetPlugin, ApprovalPlugin, CommentPlugin, DateFieldPlugin, EditTablePlugin, InterwikiPlugin, RenderListPlugin, SectionalEditPlugin, SlideShowPlugin, SmiliesPlugin, TablePlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Search

-- SharonStrait - 30 Aug 2006

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.

You can output text conditionally by using a SpreadSheetPlugin CALC in the SEARCH format. Untested example:

%CALC{$SET(first, 1)}%
%SEARCH{ "something" nosearch="on nototal="on" format="$percntCALC{$IF($GET(first) > 0, $SET(first, 0)---++ Result$n()|*Topic*|*Summary*|$n())}$percnt|$topic|$summary|" }%

This will output a heading (---++ Result) and a table heading (|*Topic*|*Summary*|) on the first search hit.

-- PeterThoeny - 31 Aug 2006

Change status to:
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2006-08-31 - 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.