Jasper report doesn't show data as per the sorting order.

0

Hi,

I have created a report using a student  table students have their priority to be treated in ascending order, Now my sql query works find on the database side but when I try to fire the same query from jasper report it doesn't give me the same result. I also tried to set up the sorting using the field value but it didn't work. I am using Jasper studio 5.5.1 final.

pathfinder2104.work's picture
Joined: Feb 27 2014 - 8:52pm
Last seen: 5 years 3 weeks ago

Kind of difficult to reply because you haven't specified which database you're using and your sql statement.

hozawa - 5 years 5 months ago

3 Answers:

0

Something was wrong on my end. I was placing the List element in the details band and hence the same set of data was being repeated all over many pages. I found it out when I created the jrxml for same report again ..... :) :)  Thank you for your efforts in reading and answering this question.  Especially fcerbell ... :) :)

 

pathfinder2104.work's picture
Joined: Feb 27 2014 - 8:52pm
Last seen: 5 years 3 weeks ago
0

Hi,

The dataset sort feature is useful when the query language does not support the kind of sorting that you want to achieve.

If you get a list of cities from a SQL database and you want to sort them on their population fetched from a webservice, for example. It can also be because you want to sort and the query language does not allow sorting at all.

It your case, did you try to add an ORDER BY statement to your SQL query ? Did your qery returned what you expected when you ask to preview the data (the tab at the bottom of the query dialog) ?

Regards

François

fcerbell's picture
264
Joined: Aug 14 2011 - 1:00pm
Last seen: 4 years 7 months ago

I have used the dataset sorting feature using the same field, it didn't work. I am already using the ORDER BY in my query. I can see the desired output in my query browser. I have checked the data preview but no data is visible in there however for the same set of parameters I can see data in report and in query browser too.

pathfinder2104.work - 5 years 5 months ago
0

My solution for this problem.

In this case i have 2 parameters, both are from prompt and class java.util.date:

  1. start_date ( default value = DATE(2014,01,01)      ) 
  2. end_date ( default value = new java.util.Date()      )

And i have this "conditional"  in my query

 

SELECT...

FROM...

WHERE  "here your date data column"   BETWEEN   CONVERT( DATE, $P{start_date} )     AND    convert(varchar(25),convert(date,$P{end_date }) ) + ' 23:59'

hmurillop's picture
Joined: Jun 7 2014 - 10:36am
Last seen: 5 years 1 week ago
Feedback
randomness