Jump to content
Changes to the Jaspersoft community edition download ×

Passing parameter/variable into substring?


wilxom

Recommended Posts

An error message was prompted out when i try to insert argument(PARAMETERS) into the substring statement.

 

Error Message:

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. The method substring(int) in the type String is not applicable for the arguments (Integer) value = (java.lang.String)(((java.lang.String)field_NLHASH.getValue()).substring( ((java.lang.Integer)parameter_pendM.getValue()) ));//$JR_EXPR_ID=8$ <------->

 

Example:

 

$F{NLHASH}.substring( $P{pbeginM}, $P{pendM} )

 

I tested both parameter having values but it display an error saying that the method substring(int) in the type String is not applicable for the arguments (Integer).

 

Please help. Thanks

 

Regards,

Wilson

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Thanks for your reply.

With the solution provided, i manage to past the parameter or variable into the substring. I just added intValue() at the back of each parameter.

Please refer to the below statement:

 

$F{NLHASH}.substring( $P{pbeginM}.intValue(), $P{pendM}.intValue() )

 

Thanks for the solution provided.

 

Regards,

Wilson

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...