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
--
SharonStrait - 30 Aug 2006
Answer
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