2004 IR Help Posted August 28, 2006 Share Posted August 28, 2006 By: Roberto Rios - bobrivers iReport x JasperReports 2002-12-09 08:46 Hi, I am experiencing some weird problems. I developed a report that simply list some database items. When I use iReport, everything works fine. No problem occurs. I am able to build, compile and generate a PDF file. But, my application will run over the Internet. So, when I try to use the XML generated through iReport, I receive some errors during the PDF creation. No errors occurs when I compile the XML. I use a SQL query with ALIAS : SELECT nom_fila, COUNT(cod_chamado) AS total_fila, (SELECT COUNT(cod_chamado) FROM v_chamado) AS total_geral FROM v_chamado GROUP BY nom_fila ORDER BY total_fila DESC When I try to generate de PDF, I receive the following error : dori.jasper.engine.JRException: Unable to get value for field 'total_geral' of class 'java.lang.Integer' As you can see, it doesn't accept the column that uses the alias. I know that the errors occurs in JasperReports classes, but I have already posted a message into JasperReports forum. I have decided to post it here too, because I was wondering if iReport could have some incompatibility with JasperReports... I also decided to post the message here, because I saw some problems regarding SQL with alias, so maybe someone could help me. TIA, Roberto By: Giulio Toffoli - gt78 RE: iReport x JasperReports 2002-12-09 11:27 In general there is not know incompatibility between iReport and JasperReport. I can suggest some test that you can perform to find the problem (and than the solution). 1. Try to execute on your server the the IReportCompiler coping and pasting the command used by iReport (it appeare when you compile on IReport compiler window and is's some like "java -D .... IReportCompiler.class ...." The execution generate a pad file. 2. You can try to write a simple class to print out your result set. 3. Check that you are using the same JDBC driver with iReport and with your servlet 4. The data that you read is the same that you are reading on internet (for example iReport read data for cod_chamado like 1,2,3,4,5 and on internet the data is... 2.123, 3.0302, 239.23 (first numbers are all Integer, the seconda are Double...)? 5. Are you sure that cod_chamado is an Integer? I hope this helps you. Giulio By: Roberto Rios - bobrivers RE: iReport x JasperReports 2002-12-10 02:07 Hi, After that I post this message, I did some tests, and the problem isn't related with iReport. I don't know why, but I am not able to use column alias with JasperReports. If I use it, I always receive an error telling me that the column name doesn't exist or is not recognized... Even if I try to use a simple query like SELECT txt_name AS user FROM my_table. If I remove the alias, it works fine. I have tried with strings, ints, doubles, etc... The funny thing, is that iReport accepts the alias, but Jasper doesn't. Thanks, Roberto Link to comment Share on other sites More sharing options...
kcd83 Posted January 10, 2013 Share Posted January 10, 2013 For those that land here it is apparently to do with JDBC .... http://community.jaspersoft.com/questions/513345/altering-jrresultsetdatasource-alias-support Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now