DataFaucet ORM

And/Or Filter

An And/Or Filter is a convenient method of providing powerful search filtering to users without writing an abundance of code. An and/or keyword filter is created with a column list and a search phrase. The filter parses the phrase using locale-specific keywords to produce a user-driven search.

Example:

<cfscript>
  // get the datasource
  ds = request.DataFaucet.getDatasource(); 
  // create a select statement 
  stmt = ds.getSelect("*","tblForumMessage msg"); 
  
  // filter by the user's search phrase 
  stmt.andOrFilter("subject,message,authorName",form.searchPhrase); 
  
  // get the results 
  query = stmt.execute(); 
</cfscript>

The statement object also provides an and/or collection filter for use in creating "advanced search" forms. These filters behave similarly to the collection filter although they don't have either the comparison or like property.

<cfset stmt.andOrCollectionFilter(form) />