I figured it out, it was the code in :

version 1.2.0

file:
net/sf/jasperreports/engine/JRResultSetDataSource.java

line: 335
was:
  if (fieldName.equalsIgnoreCase(metadata.getColumnName(i)))
SHOULD BE:
  if (fieldName.equalsIgnoreCase(metadata.getColumnLabel(i)))

This way the label gets picked up FOR SURE.

And of course you have to recompile and etc.

I hope admins of the project add this change to the future releases.

Cheers,

Alex



> Hi Everyone,
>
> I saw the email below in the archives and I'm having the same problem: the 
> iReport doesn't acknowledge the aliases at runtime.
>
> The report SQL is automatically parsed fine and all fields are parsed fine 
> with the correct alias names.
>
> But at runtime it throws an exception about Unknown column name: THE_ALIAS
>
> I get that error only if I use the new version 1.2.0, if I use the old 
> version that I have 0.4.0 it works fine, and since I'm using the same driver 
> from the same jconn3.jar, I'm thinking it has to do with iReport.
>
> Anyone else having the same issue?
>
> Alex
>
>
>
> From: Barry Klawans <[EMAIL PROTECTED]>
>  Re: Field Alias
> 2005-10-28 12:04
>
>
>  That sounds like the field names did not get set to the alias name
>  correctly, so that the report engine doesn't see a declaration of the
>  field named "tableA_name".  In iReport bring up the Report Query
>  window and check what the lower half shows as the field names.  I bet
>  they show "name" twice.  If so, make sure that "Automatically
>  Retrieve Fields" is selected.  If it is selected, and you have the
>  aliases in the query but they aren't showing up in the field list,
>  that means the JDBC driver you are using isn't showing the aliases
>  correctly.
>
>  If that is the problem, the fix is pretty easy.  Leave the Query
>  window and bring up the Report Fields window.  (Go to the View menu
>  and select "Report Fields".  In this window you should see a field
>  called id, and possible one or two named "name".  Rename one to
>  tableA_name and the other to tableB_name.  If the list only shows one
>  field called "name" simply add a new one.
>
>  One last thing to watch out for.  Some drivers map alias names to all
>  lower  case (like the PostgreSQL driver) so the names may need to be
>  "tablea_name".
>
>  -Barry Klawans
>
>  On Oct 27, 2005, at 5:38 PM, Sigit Purnomo M wrote:
>
>  > Hello.. I'm new in Java and JasperReports. But I already try
>  > to create / design some report using iReport 0.5.1. But I found a
>  > problem: How can I
>  > use some field with the same name? For example I have this query:
>  >
>  > select a.id, a.name as tableA_name, b.name as tableB_name
>  > from tableA a, tableB b
>  > where a.id = b.id
>  >
>  > When I compile report with that query, it return this error:
>  >
>  > net.sf.jasperreports.engine.JRException: Report design not valid :
>  > 1. Field not found : tableA_name
>  > .....
>  >
>  >
>  >
>  > So, is there anyone can help me?
>  >
>  >
>  > Thanx in advance
>  >
>  > Sigit Purnomo M
>  > Indonesia
>  >
>
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> jasperreports-questions mailing list
> jasperreports-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jasperreports-questions
                                      
                                   
                      
                                   
                                       


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
jasperreports-questions mailing list
jasperreports-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jasperreports-questions

Reply via email to