SID-00857: Filter table not filtering correctly
| Status: |
Answered |
TWiki version: |
4.2.4 |
Perl version: |
|
| Category: |
CategorySearch |
Server OS: |
Linux |
Last update: |
15 years ago |
I am trying to filter the results returned by a seach that searches a table. The filter works by letting the user pass URLPARAMS through a form and then searching for those specific values in the table(which is its own topic). When I seach for the URLPARAMS, I perform a regular expression AND by using the ";" character between parameters. The problem is when the code executes, it seems to give priority to the farthest right URLPARAM in the AND statement and ignore all other parameters. For example, in the search code below if %URLPARAM{"qPh"}% was equal to "1" and %URLPARAM{"qMile"}% was equal to "review" the search result should include all table entries with both "1" and "review" in them. However, it actually returns all results with "review" in them, regardless if they include the number "1" or not.
Code:
%CALC{"$PROPERSPACE(%TOPIC%)"}%
<form action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%">
| *Filter:* | *Phase:* | *Major Milestone:* | *Deliverable:* | *Completed:* | *ECD:* |
| *<input type="submit" value="Filter" />* | *<select name="qPh" size="1"> <option>%URLPARAM{"qPh"}%</option><option></option> <option>1</option><option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> </select>* | *<select name="qMile" size="1"> <option>%URLPARAM{"qMile"}%</option><option></option> <option>DOS Review</option> <option>Design Review</option> <option>Product Plans</option><option>Tapeout Complete</option> <option>1st Silicon Out</option> <option>Characterization</option><option>Release to Production</option><option>Final Product Review</option></select>* | *<input type="text" name="qDel" value="%URLPARAM{"qDel"}%" size="10" />* | *<select name="qComp" size="1"> <option>%URLPARAM{"qComp"}%</option><option></option> <option>Y</option><option>N</option> <option>N/A</option> </select>* | |
%SEARCH{ search=" %URLPARAM{"qPh"}%;%URLPARAM{"qMile"}%;%URLPARAM{"qDel"}%" topic ="TestTopicFilteredEditTable" type = "regex" multiple = "on" scope = "text" nofinalnewline = "on" nosearch = "on" noheader = "on" nototal = "on" format = "$text" header = "| *Phase* | *Major Milestone* | *Deliverable* | *Completed* | *ECD* |" format = "$text" }% </form>
--
ChrisSporck - 2010-06-03
Discussion and Answer
You are searching for string "1" anywhere in a page, it is quite likely that there is a "1" such as in the time stamp in the topic meta data. If you do a
QuerySearch compare the form field value to your URLPARAM value. If you use a
RegularExpression search you need to identify the form field meta data, such as
META:FIELD.*name=.Phase.*value=.%URLPARAM{"qPh"}%
Also, make sure to encode URLPARAM values properly, see
VarURLPARAM.
--
PeterThoeny - 2010-06-03
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
PeterThoeny - 2010-08-02
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.