Question
Hi! I want to find all topics that have SomeForm attached and to display the values of the formfields for each topic in a table.
QuerySearch sounds like the perfect way to reach that, but I'm not able to get it right.
%SEARCH{ "form.name='SomeForm'" type="query" expandvariables="on" format="| $formfield('Title') | $formfield('TopicTitle') | $formfield('Rating') | $formfield('Alternatives') |" }%
The searched topics are found, table is shown. But some columns have corrupted entries. Problem seems to be that some of the values in the fields of the topics forms are created dynamically, because the static ones (text, select) are shown like wanted. The dynamic %VARIABLES% look like substituted with the corresponding values of the SearchTopic. $formfield('TopicTitle') alias %TOPIC% becomes SearchTopic. $formfield('Rating') alias %VOTE% becomes 0, ..
O.K., no problem with the %TOPIC% variable because of FormattedSearch variable $topic. But, no way for some other TWikiVariables and PluginVariables?
BTW, the expandvariables="on" of the FormattedSearch does not seem to expand the variables like it sounds. Do i overlook something?
Is it possible to do this with a type="query" FormattedSearch? I really would like to use the nice operators of the
QuerySearch! So any help on this is very much appreciated! Thanks. Ingo
Environment
--
IngoBlickling - 11 Apr 2008
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.
If the actual values in the topic form fields are TWiki variable such as %TOPIC then these will be evaluated in the current scope - ie %TOPIC will show the topic name of the topic from which the search is run.
If what you want to show is the name of the found topic then the formatted search has variable for this like $topic.
--
KennethLavrsen - 12 Apr 2008
Thank you for your fast reply, Kenneth! It clearified how variables are evaluated and enabled me searching and thinking further.
So expandvariables="on" too is not to expand the variables of the found topics in the scope of the search hit, but in that of the search topic!? On first reading of
VarSEARCH I understood it completely the other way round; probably kind of "what someone sees is what someone wants to see" ...
Is there a workaround to pre-render other TWikiVariables and PluginVariables in the scope of the found topics and to use these evaluated values in a search?
I thought about
a) using nested searches, SpreadSheetPlugin, .. to evaluate variables in the scope of the found topics "on the search fly"
b) evaluating variables within the topics and saving the values additionally in the topics (e.g. at time of a view or rating of the topics with SomeForm) to make them available for a search.
Is there a way to do one of these without enhancing Plugins or TWiki code?
--
IngoBlickling - 13 Apr 2008
Closing this question after more than 30 days of inactivity. Feel free to re-open if needed.
--
PeterThoeny - 03 Jun 2008