aspose file tools*
The moose likes Java in General and the fly likes Filter data in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Filter data in Java" Watch "Filter data in Java" New topic
Author

Filter data in Java

Anirudha Joshi
Greenhorn

Joined: Apr 08, 2005
Posts: 22
I am developing a screen on which user can see various details of an Employee. Details includes fields like Name, Date Of birth, Salary etc.
Server side code retrieves data for an employee using different data sources. Some fields are retrieved from the database using JDBC while other are retrieved from external system using API calls.

Now, application also allows end-user to configure different VIEW filters and end user can apply them while viewing the data. For ex: User can setup a filter as "Show Employee where firstname like 'A' and DOB > '2/2/2000'.

Issue is, how do I filter the dataset?

If user sets a filter on the attribute which is getting retrieved from JDBC, I can append this filter in the SQL string as WHERE clause (for ex: where emp.first_name like 'A%'). So no issues for SQL fields.

But how do I apply filter criteria which is set on the non SQL attributes?

One of the solution which I tried to implement is converting final dataset into XML and then applying filter using XPATH. But as I understand XPATH can be used only for String and numeric values. It can not be used for dates and filter criteria like "WHERE DEPTNAME IN A, B, C, D).

Any ideas?
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Crossposting (advanced) is not the best idea to solve a problem.

[ August 20, 2005: Message edited by: Stefan Wagner ]

http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filter data in Java