Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filter data in Java

 
Anirudha Joshi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Crossposting (advanced) is not the best idea to solve a problem.

[ August 20, 2005: Message edited by: Stefan Wagner ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic