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.
3 Answers:
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 ... :) :)
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
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.
My solution for this problem.
In this case i have 2 parameters, both are from prompt and class java.util.date:
- start_date ( default value = DATE(2014,01,01) )
- 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'
Kind of difficult to reply because you haven't specified which database you're using and your sql statement.