Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Intro

In 2002 I posted a node entitled RFC on module idea, well nearly 4 years later I have a 1.0 version release of the concepts first discussed in that post. Introducing FilterOnClick. All the features mentioned in my original post either exist or have been improved upon under the FilterOnClick banner.

The current implementation is a Plugin for Class::DBI and is available as Class::DBI::Plugin::FilterOnClick. FilterOnClick from an abstraction standpoint owes a great deal to the Class::DBI approach to database interaction.

FilterOnClick is based on two specific techniques of interacting with data sets:

Knowledge based interaction - Interaction when you know what you are looking for. Example - You know the person wants all the items in blue with a star pattern.

Discovery based interaction - Not knowing specifically what you are looking for or perhaps looking for an anomaly. Example - You want to look for out of place data or interesting values to determine their frequency of occurrence.

The name FilterOnClick is derived from the actual interaction with the data sets via the browser. An HTML table is produced and particular values within a cell can be clicked on (if configured appropriately) to "filter" the results. If a column (database field) is configured as searchable a search can be done based on any string. It also has support for NULL and empty fields to assist with finding an anomaly. Another feature is the ability to cascade filters across multiple columns. This allows for a drill down into a specific type of item you would like. In addition to cascading they are not fixed in order so you can selectively remove or add filters at anytime in the process.

An example use of FilterOnClick would be an automobile sales web site.

We will use a database containing car information as our example dataset. In the database you have the common attributes of each vehicle; mileage, color, price, transmission type, year, make, model, etc. Using Class::DBI::Plugin::FilterOnClick you can create a CGI script and make any click on year equal a filter for an exact match look up if clicked. That would allow a user to find the year they are interested in and then filter to just that year. A variance filter offers a little power, you can use the variance and look up and down x number of years, where x is the difference.

So using a variance of 2 instead of an exact match allow the user to show all cars between 2001 - 2005 years if they clicked on 2003.

If price is added and setup as searchable + a variance you could search for all cars with an exact price (say $20,000, for example) and then with a percent variance click on any $20,000 cell value and find all cars between 2001 - 2005 priced within 5% of $20,000 since our filters cascade.

Now we add another FilterOnClick rule on mileage, here again we use a variance, this time 10% and that column is searchable as well. We type in 30000 for the search criteria which shows all vehicles with 30K (if any), we can now click on a 30K value in any cell in the price column.

With all the above filters available and applied the user will now see all 2001 - 2005 cars with 27,000 - 33,000 miles on them with a price between $19,000 and 21,000.

Now based on our available options our user decides the year restriction is too limiting, which is what we chose first, we can now click on any value in the year colum and the filter on year is remove, but the other filters remain valid. In other words we are only filtering on price and miles now.

Multiple combinations of the above can be created simply by adding a filter type on a particular column. FilterOnClick makes it easy to create unique lookups that otherwise would require custom programming to meet a particular condition that is prone to change.

Class::DBI::Plugin::FilterOnClick can also be used to connect databases that you don't have write access to. Using a connector table you can record notes based on the your discovery in the read only database back to your writable database. You can even include content from within multiple databases with a single table based on the primary key of the base table.

Feature List
  • Percentage Variance based filters
  • Numerical Variance based filters
  • Exact match based filters
  • Starts with match based filters
  • Ends with match based filters
  • Order by on a per column basis (currently only supported on the base table)
  • Ability to color(ize) values matching a regex on a per cell basis
  • Substitute your own custom filter by passing in a subroutine
  • Automatic record set navigation creation
  • Configuration file based settings, currently based on Config::Magic allowing for multiple configuration file formats
  • Searchable fields based, including the ability to find NULL and empty strings
  • CSS based coloring of table elements
  • Creation of string based navigation (alphabetical, numerical, groups of either, etc.)
  • Highlighting on currently filtered columns
  • Ability to add custom columns and include data from alternate datasources (excel, access, text files, etc)
  • Tables based on HTML::Table allowing for OO based access to auto rendered table for further post generation tweaking
  • Result pages can be booked for future reference or mailed to other users (assuming you use GET and not POST for the method on the form)


Future Features

  • Less than/equal Variance based filters
  • Greater than/equal Variance based filters
  • Order by based on columns from any table (most likely to completed by a secondary JavaScript level sort)


FilterOnClick Demo site

This module relies heavily on a number of other CPAN modules so thank you to all the contributors to CPAN for helping make my module possible.

In reply to Introducing FilterOnClick for Perl by trs80

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 03:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found