Question
Dear TWiki-Comunity,
I face a tricky search which I try to solve the last few days. I want to search for formfields in topics, so that only the topics which includes a specific value in a formfield are shown. This value I want to set with a variable, so that I don`t have to change every search. The goal is to set this value in the url, but thats another problem a guess I can solve of my own.
My try looks like this:
%CALC{"$SET(bla, 27)"}%
%SEARCH{".*name=.*KW.*value=.*$percntCALC{\"$dollarGET(bla)\"}$percnt .*;" scope="text" topic="JobStatFrom.*" [...]
I guess the problem is, that the variable-String is interpreted as an String, `cause it sorrounded by quotes.
Any help?
Environment
--
ChristianKniep - 10 Jul 2007
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.
I think you have been too careful with trying to escape things. You want the
%CALC{...}% to be evaluated
first, so there's no need to escape the percent signs.
Let's try with the form in this topic - it has a single field named SupportStatus:
%CALC{"$SET(bla, Answered)"}%
%SEARCH{".*FIELD.name=.SupportStatus.*value=.%CALC{"$GET(bla)"}%" topic="%TOPIC%" scope="text" regex="on" nototal="on"}%
Searched: .*FIELD.name=.SupportStatus.*value=.Answered
Question Dear TWiki Comunity, I face a tricky search which I try to solve the last few days. I want to search for formfields in topics, so that only the topics which...
Adapting the same thing to URL params is as easy, you can supply a default as well:
%SEARCH{".*name=.SupportStatus.*value=.%URLPARAM{"value" default="Asked"}%" topic="%TOPIC%" scope="text" regex="on" nototal="on"}%
Searched: .*name=.SupportStatus.*value=.Asked
Now
https://twiki.org/cgi-bin/view/Support/SearchForFormfieldsWithVar should return no result in the answer (as long as the status is AnsweredQuestions), but
https://twiki.org/cgi-bin/view/Support/SearchForFormfieldsWithVar?value=Answered should.
--
HaraldJoerg - 10 Jul 2007
Hi Harald,
thx for your help, it seems like ist is an format problem in the "format="-section.
When I used this I get the right results:
%CALC{"$SET(bla, 28)"}%
%SEARCH{".*name=.*KW.*value=.%CALC{"$GET(bla)"}%" scope="text" topic="JobStatFrom.*" web="Sandbox" order="topic" type="regex" casesensitive="on" reverse="off" nonoise="on" nohaeder="off"}%
But if I add the header and format-information it kicks the CALC- and TABLE-macros I included in the header- and format-Part.
I use the table to create a dynamic chart, so I need to give the table a name and I need to count the rows...
header="$percntTABLE{name=\"nvh1\"}$percnt
| *Datum* | *Gesamt* | *Done* | *Kill* | *Die* | *Done %* | *Kill %* | *Die %* |"
format="| $percntCALC{\"$dollarSET(count_nvh_table1, $dollarEVAL($dollarGET(count_nvh_table1)+1))\"}$percnt $formfield(JaHr).$formfield(MoNat).$formfield(TaG) | $formfiel[...]
--
ChristianKniep - 10 Jul 2007