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

TWiki version: TWikiRelease04x01x02
Server OS: RHEL4
Web server: apache2
Perl version: 5.8.5
Client OS: RHEL4
Web Browser: Firefox2
Categories: Search

-- ChristianKniep - 10 Jul 2007

Answer

ALERT! 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

Results from Support web retrieved at 16:42 (GMT)

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

Change status to:
Edit | Attach | (削除) Watch (削除ここまで) | Print version | History : r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2007年07月10日 - ChristianKniep
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

AltStyle によって変換されたページ (->オリジナル) /