Bem pessoal estou tentado remodelar um relatório que esta no Crystal Reports pra Ireport.
Eu criei uma nova variavel e preciso que ela faça o seguinte:
Faça a comparação entre os campos e retone o valor da variável $F{sigla_unidade} se alguma das condições do campo $F{origem} forem satisfeitas e se não for retorne o campo $F{unidade}.
Mas a sintaxe que te passei é pra fazer direto no ireport mesmo, vc vai na Text Field Expression e digita essa sintaxe, que quando seu campo atender a condição irá imprimir uma coisa, quando nao atender será a segunda opção.
A exepressão foi validada. Mas a ocompilar e executar gerou o seguinte erro.
Erros de compilação .\RelatMicroComputadoresPorOrgao.jasper.
Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsException: 2 >= 2 at java.util.Vector.elementAt(Unknown Source) at javax.swing.plaf.basic.BasicTabbedPaneUI.getTextViewForTab(Unknown Source) at javax.swing.plaf.basic.BasicTabbedPaneUI.calculateTabHeight(Unknown Source) at javax.swing.plaf.basic.BasicTabbedPaneUI.calculateMaxTabHeight(Unknown Source) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateTabRects(Unknown Source) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateLayoutInfo(Unknown Source) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.layoutContainer(Unknown Source) at java.awt.Container.layout(Unknown Source) at java.awt.Container.doLayout(Unknown Source) at java.awt.Container.validateTree(Unknown Source) at java.awt.Container.validateTree(Unknown Source) at java.awt.Container.validateTree(Unknown Source) at java.awt.Container.validateTree(Unknown Source) at java.awt.Container.validateTree(Unknown Source) at java.awt.Container.validateTree(Unknown Source) at java.awt.Container.validate(Unknown Source) at javax.swing.RepaintManager.validateInvalidComponents(Unknown Source) at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. The method equals(Object) in the type Integer is not applicable for the arguments (int) value = (java.lang.String)((((java.lang.Integer)field_origem.getValue()).equals(3) || ((java.lang.Integer)field_origem.getValue()).equals(4) || ((java.lang.Integer)field_origem.getValue()).equals(5)) ? ((java.lang.String)field_sigla_unidade.getValue()) : ((java.lang.Integer)field_unidade.getValue()));//$JR_EXPR_ID=12$ <----> 2. The method equals(Object) in the type Integer is not applicable for the arguments (int) value = (java.lang.String)((((java.lang.Integer)field_origem.getValue()).equals(3) || ((java.lang.Integer)field_origem.getValue()).equals(4) || ((java.lang.Integer)field_origem.getValue()).equals(5)) ? ((java.lang.String)field_sigla_unidade.getValue()) : ((java.lang.Integer)field_unidade.getValue()));//$JR_EXPR_ID=12$ <----> 3. The method equals(Object) in the type Integer is not applicable for the arguments (int) value = (java.lang.String)((((java.lang.Integer)field_origem.getValue()).equals(3) || ((java.lang.Integer)field_origem.getValue()).equals(4) || ((java.lang.Integer)field_origem.getValue()).equals(5)) ? ((java.lang.String)field_sigla_unidade.getValue()) : ((java.lang.Integer)field_unidade.getValue()));//$JR_EXPR_ID=12$ <----> 4. The method equals(Object) in the type Integer is not applicable for the arguments (int) value = (java.lang.String)((((java.lang.Integer)field_origem.getOldValue()).equals(3) || ((java.lang.Integer)field_origem.getOldValue()).equals(4) || ((java.lang.Integer)field_origem.getOldValue()).equals(5)) ? ((java.lang.String)field_sigla_unidade.getOldValue()) : ((java.lang.Integer)field_unidade.getOldValue()));//$JR_EXPR_ID=12$ <----> 5. The method equals(Object) in the type Integer is not applicable for the arguments (int) value = (java.lang.String)((((java.lang.Integer)field_origem.getOldValue()).equals(3) || ((java.lang.Integer)field_origem.getOldValue()).equals(4) || ((java.lang.Integer)field_origem.getOldValue()).equals(5)) ? ((java.lang.String)field_sigla_unidade.getOldValue()) : ((java.lang.Integer)field_unidade.getOldValue()));//$JR_EXPR_ID=12$ <----> 6. The method equals(Object) in the type Integer is not applicable for the arguments (int) value = (java.lang.String)((((java.lang.Integer)field_origem.getOldValue()).equals(3) || ((java.lang.Integer)field_origem.getOldValue()).equals(4) || ((java.lang.Integer)field_origem.getOldValue()).equals(5)) ? ((java.lang.String)field_sigla_unidade.getOldValue()) : ((java.lang.Integer)field_unidade.getOldValue()));//$JR_EXPR_ID=12$ <----> 7. The method equals(Object) in the type Integer is not applicable for the arguments (int) value = (java.lang.String)((((java.lang.Integer)field_origem.getValue()).equals(3) || ((java.lang.Integer)field_origem.getValue()).equals(4) || ((java.lang.Integer)field_origem.getValue()).equals(5)) ? ((java.lang.String)field_sigla_unidade.getValue()) : ((java.lang.Integer)field_unidade.getValue()));//$JR_EXPR_ID=12$ <----> 8. The method equals(Object) in the type Integer is not applicable for the arguments (int) value = (java.lang.String)((((java.lang.Integer)field_origem.getValue()).equals(3) || ((java.lang.Integer)field_origem.getValue()).equals(4) || ((java.lang.Integer)field_origem.getValue()).equals(5)) ? ((java.lang.String)field_sigla_unidade.getValue()) : ((java.lang.Integer)field_unidade.getValue()));//$JR_EXPR_ID=12$ <----> 9. The method equals(Object) in the type Integer is not applicable for the arguments (int) value = (java.lang.String)((((java.lang.Integer)field_origem.getValue()).equals(3) || ((java.lang.Integer)field_origem.getValue()).equals(4) || ((java.lang.Integer)field_origem.getValue()).equals(5)) ? ((java.lang.String)field_sigla_unidade.getValue()) : ((java.lang.Integer)field_unidade.getValue()));//$JR_EXPR_ID=12$ <----> 9 errors at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:193) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:591) at java.lang.Thread.run(Unknown Source)
Ainda continuo com algumas dificuldades no Ireport.
Segue o erro reportado.
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. String cannot be resolved or is not a field value = (java.lang.String)((((java.lang.Integer)field_origem.getValue()).equals(new Integer(3)) || ((java.lang.Integer)field_origem.getValue()).equals(new Integer(4)) || ((java.lang.Integer)field_origem.getValue()).equals(new Integer(5))) ? ((java.lang.String)field_sigla_unidade.getValue()).String : ((java.lang.Integer)field_unidade.getValue()).langString);//$JR_EXPR_ID=12$ <----> 2. langString cannot be resolved or is not a field value = (java.lang.String)((((java.lang.Integer)field_origem.getValue()).equals(new Integer(3)) || ((java.lang.Integer)field_origem.getValue()).equals(new Integer(4)) || ((java.lang.Integer)field_origem.getValue()).equals(new Integer(5))) ? ((java.lang.String)field_sigla_unidade.getValue()).String : ((java.lang.Integer)field_unidade.getValue()).langString);//$JR_EXPR_ID=12$ <--------> 3. String cannot be resolved or is not a field value = (java.lang.String)((((java.lang.Integer)field_origem.getOldValue()).equals(new Integer(3)) || ((java.lang.Integer)field_origem.getOldValue()).equals(new Integer(4)) || ((java.lang.Integer)field_origem.getOldValue()).equals(new Integer(5))) ? ((java.lang.String)field_sigla_unidade.getOldValue()).String : ((java.lang.Integer)field_unidade.getOldValue()).langString);//$JR_EXPR_ID=12$ <----> 4. langString cannot be resolved or is not a field value = (java.lang.String)((((java.lang.Integer)field_origem.getOldValue()).equals(new Integer(3)) || ((java.lang.Integer)field_origem.getOldValue()).equals(new Integer(4)) || ((java.lang.Integer)field_origem.getOldValue()).equals(new Integer(5))) ? ((java.lang.String)field_sigla_unidade.getOldValue()).String : ((java.lang.Integer)field_unidade.getOldValue()).langString);//$JR_EXPR_ID=12$ <--------> 5. String cannot be resolved or is not a field value = (java.lang.String)((((java.lang.Integer)field_origem.getValue()).equals(new Integer(3)) || ((java.lang.Integer)field_origem.getValue()).equals(new Integer(4)) || ((java.lang.Integer)field_origem.getValue()).equals(new Integer(5))) ? ((java.lang.String)field_sigla_unidade.getValue()).String : ((java.lang.Integer)field_unidade.getValue()).langString);//$JR_EXPR_ID=12$ <----> 6. langString cannot be resolved or is not a field value = (java.lang.String)((((java.lang.Integer)field_origem.getValue()).equals(new Integer(3)) || ((java.lang.Integer)field_origem.getValue()).equals(new Integer(4)) || ((java.lang.Integer)field_origem.getValue()).equals(new Integer(5))) ? ((java.lang.String)field_sigla_unidade.getValue()).String : ((java.lang.Integer)field_unidade.getValue()).langString);//$JR_EXPR_ID=12$ <--------> 6 errors at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:193) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:591) at java.lang.Thread.run(Unknown Source)