SID-01426: Formatted Search Conditional based on Topic Formfield value
| Status: |
Answered |
TWiki version: |
5.1.0 |
Perl version: |
|
| Category: |
CategorySearch |
Server OS: |
|
Last update: |
13 years ago |
Hi,
I have the following formatted search and I am trying to add a new field where a conditional result is displayed, based on the value of a formfield for that given topic.
The formatted search is as follows...
=
%TABLE{ sort="on" initsort="1" initdirection="down" }%
%SEARCH{ "TopicClassification.*?value=\"DeviceRecord\";Mornington" type="regex" excludetopic="*Template,DeviceRecord*,WebHome" web="Customers" nonoise="on" nototal="off" order="topic" format="|
$topic %ISNEW% | $percntIF{\"'$formfield(
NagiosReference)' = 'Mornington'\" then=\"$formfield(
NagiosReference)\" else=\"N/A\"}$percnt | $formfield(
DeviceLocation) | $formfield(
SerialNumber) | $formfield(
DeviceVendor) | $formfield(
DeviceModel) |
CustomerCode)?topicparent=Support.SID-01426;nowysiwyg=0" rel="nofollow" title="$formfield(CustomerCode) (this topic does not yet exist; you can create it)">$formfield(CustomerCode) | $formfield(
TechnicalTeam) | $formfield(
SupportCoverage) | $formfield(
DeviceStatus) | <a href=%SCRIPTURL{edit}%/%WEB%/$topic?action=form;t=%SERVERTIME{$epoch}%;nowysiwyg=1 title='Edit $topic'><img alt='Edit $topic' src='%ICONURL{"edittopic"}%' /></a> <a href=%SCRIPTURL{oops}%/%WEB%/$topic?template=oopshistory;t=%SERVERTIME{$epoch}% title='Diff $topic'><img alt='Diff $topic' src='%ICONURL{"topicdiffs"}%' /></a> <a href=%SCRIPTURL{oops}%/%WEB%/$topic?template=oopsmore;t=%SERVERTIME{$epoch}% title='More $topic actions'><img alt='More $topic actions' src='%ICONURL{"toolbox"}%' /></a> <a href=%SCRIPTURL{rename}%/%WEB%/$topic?newweb=Trash;nonwikiword=on;t=%SERVERTIME{$epoch}%;nowysiwyg=1 title='Delete $topic'><img alt='Delete $topic' src='%ICONURL{"trash"}%' /></a> |" limit="1" }%
=
Any help would be gladly appreciated.
Cheers,
Cameron.
--
CameronWood - 2012-03-16
Discussion and Answer
The conditional
$percntIF{\"'$formfield(NagiosReference)' = 'Mornington'\" then=\"$formfield(NagiosReference)\" else=\"N/A\"}$percnt looks OK to me, it is escaped to execute once per search hit. What do you get?
BTW, I find it interesting that you do Nagios and TWiki stuff using TWiki forms. I invite you to
write a TWiki.org blog about this.
--
PeterThoeny - 2012-03-16
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
PeterThoeny - 2012-07-01
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.