How do you call a Java method with two parameters from JasperReports

snafua

I have a JasperReports' jrxml file that contains calls of Java method code with one int parameter. All works well with the following code using a single parameter. eventProjectid is an Integer

<textField>
    <reportElement positionType="Float" x="250" y="79" width="103" height="15"/>
    <textFieldExpression><![CDATA[com.rem40.reports.ReportUtils.getCubeXAxisLabelMaxConsequenceProject($F{eventProjectId})]]></textFieldExpression>
</textField>

I need to introduce a second parameter which does not work, all I get is a null value back. Here is the jrxml code eventProjectId is an Integer and eventType is a String.

<textField>
    <reportElement positionType="Float" x="250" y="79" width="103" height="15"/>
    <textFieldExpression><![CDATA[com.rem40.reports.ReportUtils.getCubeXAxisLabelMaxConsequenceProject($F{eventProjectId},$F{eventType})]]></textFieldExpression>
</textField>

Here is the Java code that I am trying to call

public static String getCubeXAxisLabelMaxConsequenceProject(Integer projectId, String eventType){
    ProjectEntity projectEntity = projectService.findById(projectId);

    CubeConfigEntity cubeConfigEntity=cubeConfigService.findByCubeTypeName(eventType,projectEntity.getCubeConfigName());
    if (cubeConfigEntity != null) {
        return cubeConfigEntity.getxAxisName();
    } else {
        return "";
    }
}

Just to be clear I have tried to debug the call to no available. I believe there is an issue with how the method signature try to compare from the jrxml to the Java method. In debug the single parameter methods get called but the method with two parameters never gets called.

Any help would be appreciated.

leeyuiwah

Your method

com.rem40.reports.ReportUtils.getCubeXAxisLabelMaxConsequenceProject()

has gone through two versions, right? One accepts a single integer argument, and the other version accepts an integer and a string as arguments. Please double check that your japser report is pointing to the new version of the class file or library.

Also, please make sure that the two fields that you use, do have valid values with them

$F{eventProjectId}
$F{eventType}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do you call a subclass method from a superclass in Java?

From Dev

How do you call a subclass method from a superclass in Java?

From Dev

How do you call a Word method and pass parameters?

From Dev

How do you call class method from initialize method?

From Dev

How do you call class method from initialize method?

From Java

How do you call a method from within a Collector in Java 8 Streaming?

From Dev

How do you call a static method in my own Java class from Clojure?

From Dev

How to pass parameters to sub subreports from java code JasperReports

From Dev

How do you call a scanner variable from main into another method?

From Dev

How do you call a method in one class, from another class?

From Dev

How do you call a method inherited from another class?

From Dev

How do you call a service method from a class?

From Dev

How do you call a method in one class, from another class?

From Dev

How do you call a service method from a class?

From Dev

How do you call a scanner variable from main into another method?

From Dev

How do you call a method from a different package?

From Java

How do you call a method of a generic type in java?

From Dev

How do you call subclass method in superclass, in Java?

From Dev

How to call a method with parameters from an optional object in java

From Dev

How to call a method with parameters from another class in java?

From Dev

Jelly - how to call java method with parameters from jelly tag

From Dev

How do you read from and combine two files together in java?

From Dev

How to call parameters from one method to another?

From Dev

How do I call a method from a class that was not instantiated in Java?

From Dev

How do I call a method from another class in Java?

From Dev

How do I call a method from a class that was not instantiated in Java?

From Dev

How do I call actionPerformed method from another class in java

From Dev

How do you call a subclass method in the baseclass method?

From Dev

How do you call a method in an activity from a broadcastreceiver that is registered in manifest without starting the activity with an intent?

Related Related

  1. 1

    How do you call a subclass method from a superclass in Java?

  2. 2

    How do you call a subclass method from a superclass in Java?

  3. 3

    How do you call a Word method and pass parameters?

  4. 4

    How do you call class method from initialize method?

  5. 5

    How do you call class method from initialize method?

  6. 6

    How do you call a method from within a Collector in Java 8 Streaming?

  7. 7

    How do you call a static method in my own Java class from Clojure?

  8. 8

    How to pass parameters to sub subreports from java code JasperReports

  9. 9

    How do you call a scanner variable from main into another method?

  10. 10

    How do you call a method in one class, from another class?

  11. 11

    How do you call a method inherited from another class?

  12. 12

    How do you call a service method from a class?

  13. 13

    How do you call a method in one class, from another class?

  14. 14

    How do you call a service method from a class?

  15. 15

    How do you call a scanner variable from main into another method?

  16. 16

    How do you call a method from a different package?

  17. 17

    How do you call a method of a generic type in java?

  18. 18

    How do you call subclass method in superclass, in Java?

  19. 19

    How to call a method with parameters from an optional object in java

  20. 20

    How to call a method with parameters from another class in java?

  21. 21

    Jelly - how to call java method with parameters from jelly tag

  22. 22

    How do you read from and combine two files together in java?

  23. 23

    How to call parameters from one method to another?

  24. 24

    How do I call a method from a class that was not instantiated in Java?

  25. 25

    How do I call a method from another class in Java?

  26. 26

    How do I call a method from a class that was not instantiated in Java?

  27. 27

    How do I call actionPerformed method from another class in java

  28. 28

    How do you call a subclass method in the baseclass method?

  29. 29

    How do you call a method in an activity from a broadcastreceiver that is registered in manifest without starting the activity with an intent?

HotTag

Archive