Question
It seems like it should be simple enough but I have not been able to figure out how to display the value of one of the fields in
TWikiForms elsewhere within the same topic. I am wanting to do this as part of my implementation of
AllowDesignationOfSummary inwhich I create a topic summary or "headline" field within the
WebForm and would also like to display this field value at the top of the topic.
Thanks for any help!
--
LynnwoodBrown - 31 May 2002
Answer
You can do this with a
FormattedSearch. The example pull the
SupportStatus out of this topic.
- You type:
%SEARCH{ "^%TOPIC%[^a-zA-Z0-9]" scope="topic" limit="1" regex="on" nosearch="on" nototal="on" format="$formfield(SupportStatus)" }%
--
PeterThoeny - 31 May 2002
Thanks, Peter! That's exactly what I was after. Looking at the search string, I am once again impressed how arcane regular expressions are to the uninitated. Since the search string here is so short, I though it would be a good example for me to try to deconstruct and understand how this string identifies the current topic - but no luck.
Anyone willing to help me understand this simple regular expression? Why not just have the %TOPIC% variable by itself in the search string?
--
LynnwoodBrown - 31 May 2002
The
[^a-zA-Z0-9] matches a single non-alphanumeric character - the idea is to only find ThisTopic not ThisTopicAsWell, since the pattern
ThisTopic[^a-zA-Z0-9] will only match the former. Have a look at a regular expression tutorial and try writing some expressions yourself - much easier to experiment yourself as part of learning.
See Wikilearn.RegexExpTWikiEndAnchorWorkaround -- RandyKramer - 01 Jun 2002.
--
RichardDonkin - 31 May 2002
"^%TOPIC%[^a-zA-Z0-9]" is not the correct regex to find exactly
%TOPIC% without leading or trailing characters. This is because the regex finishes scanning with a match at "not followed by a alphanumeric character".
"^%TOPIC%$" is the correct regex. Note that this requires the
CantAnchorSearchREToEnd fix.
--
PeterThoeny - 01 Aug 2002