Tags:
create new tag
view all tags

SID-00224: Searching formfields

Status: Answered Answered TWiki version: 4.2.3 Perl version:
Category: CategorySearch Server OS: Last update: 17 years ago

I apologize for the very basic nature of this question however I am struggling with how to perform a search.

I've used the FormBaseTableTutorial that will allow me to create a series of topics all with a form containing info on animals. If I run the following search I get the result of everything in my forms.

%SEARCH{"Animals[0-9]" scope="topic" nototal="on" regex="off" nosearch="on" casesensitive="on" format=" | $formfield(Category) | $formfield(Animal) |

Category Animal
4 legs cow
4 legs sheep
2 legs chicken
5 legs dinosaur
4 legs cat
4 legs dog
3 legs tricycle

Is it possible to do a search where it will only display the unique entries for each Category? Ie. 2 legs, 3 legs, 4 legs, 5 legs.

Then allow the user to click either 2 legs, 3 legs, 4 legs, 5 legs and further expand the search to include only those animals that had the chosen number of legs?

-- JaniHamalainen - 26 Mar 2009

Discussion and Answer

You could do a search to show the categories only, taking them from some place where you declare the categories, not from the topics with the forms.

In the format of that search you must generate the link calling a topic that performs a search in the topics with the form, passing the category in one parameter (let's say qCategory). This second search would look like this

%SEARCH{ "[C]ategory.*value\=.%URLPARAM{"qCategory" default = "*" }%" 
scope="text" type="regex" nosearch="on" 
format=" | $formfield(Category) | $formfield(Animal) |" }%

-- EnriqueCadalso - 27 Mar 2009

Look also into query-by-example forms where you glue an HTML form and a %SEARCH{}% with %URLPARAM{}%. See example form in "Find extensions" section of Plugins.WebHome that calls Plugins.SearchExtensions

More at VarSEARCH, VarURLPARAM, FormattedSearch, QuerySearch, TWikiTemplates.

-- PeterThoeny - 27 Mar 2009

Thank you both for the help. I ended up declaring the categories on a table in another topic as EnriqueCadalso suggested and then using the QuerySearch that PeterThoeny suggested.

-- JaniHamalainen - 01 Apr 2009

      Change status to:
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.
SupportForm
Status Answered
Title Searching formfields
SupportCategory CategorySearch
TWiki version 4.2.3
Server OS

Web server

Perl version

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2009-04-02 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
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.