This question about Missing functionality: Answered
I want to create a dynamic list of topics. Formatted output shall contain conent of a formfield, but about 1000 old topics do not contain this field, instead I want to use $createdate (but only for this old topics)
what I tried:
%SEARCH{ "ToolName_.*_ToolUpdate" regex="on" scope="topic" nosearch="on"
header="|*Topic*|*Release Date*| "
format="| $topic | %CALC{$IF( $EMPTY($formfield(ReleaseDate)), $createdate, $formfield(ReleaseDate) )}% |"
}%
I am not getting the $createdate, i.e. formfield is never empty. Is this because of order of SEARCH and
SpreadSheetPlugin is executed - I do not think so? What am I doing wrong here- how can I overcome this issue?
I tried a live example in this web, the string
"no version defined" shall be displayed if field is empty:
%SEARCH{ "BestPracticeTip1\d" regex="on" scope="topic" nosearch="on"
header="|*Tip*|*Version*| "
format="| $topic | %CALC{$IF( $EMPTY($formfield(Version)), no version defined, $formfield(Version) )}% |"
}%
results in
Number of topics: 13
--
MatthiasThullner - 06 Jun 2011
This can be done by the following query search:
%SEARCH{"name~'BestPracticeTip1*'" web="%WEB%" type="query" nosearch="on"
header="|*Tip*|*Version*|"
format="| $topic | $percentIF{\"'$topic'/Version\" then=\"$formfield(Version)\" else=\"no version defined\"}$percent |"
}%
which results in:
Number of topics: 14
So you should redefine your regex search as query search and/or use the delayed IF in the format string as I did below:
%SEARCH{ "ToolName_.*_ToolUpdate" regex="on" scope="topic" nosearch="on"
header="|*Topic*|*Release Date*| "
format="| $topic | $percentIF{\"'$topic'/ReleaseDate\" then=\"$formfield(ReleaseDate)\" else=\"$createdate\"}$percent |"
}%
--
FranzJosefGigler - 09 Jun 2011
Danke Franz Josef,
on my system (Foswiki 1.0.9) $percent does not work, but $percnt does
%SEARCH{ "ToolName_.*_ToolUpdate" regex="on" scope="topic" nosearch="on"
header="|*Topic*|*Release Date*| "
format="| $topic | $percntIF{\"'$topic'/ReleaseDate\" then=\"$formfield(ReleaseDate)\" else=\"$createdate\"}$percnt |"
}%
--
MatthiasThullner - 13 Jun 2011