Jump to content
We've recently updated our Privacy Statement, available here ×

Jasperserver Array parameter issue


bipinm25

Recommended Posts

I have a query

select * from crm_query where $X{IN,ref_no,ref_no}` in `jasper report

The parameter ref_no its class is java.util.Collection.

The report work perfectly in jasper soft report. But not working injasper server.

This is the url for connecting jasper server

http://localhost:8080/jasperserver/rest_v2/reports/reports/projects/test_report.pdf?ref_no=31&ref_no=29&ref_no=33

My issues is that jasper server getting NULL value for the parameter ref_no. Why this happening like this? Any solution?

Also i tried to print the parameter in report,but it prints nothing.

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Yes now i am getting the paramter in that report .But another issue is occure  I cant use that parameter in print when expression field I use this code <printWhenExpression><![CDATA[$P{ref_no}.contains( $F{query_id} )]]></printWhenExpression>    

 

I dont want to use that paramter in any query. I want to check the parameter value in query return result.? How to do that?

Link to comment
Share on other sites

Well, I think that's right so, I don't know why does not work.

I suggest to put three text fields in detail band and see what shows:

  - One for $P{ref_no}

  - Another for $F{query_id}

 - And the last for $P{ref_no}.contains( $F{query_id} )

Perhaps you can see an explanation of what it's happens.

Mariano

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

There might be better ways to do it, but for me, for comparing the value inside the array, I always use:

((ArrayList) $P{REPORT_PARAMETERS_MAP}.get( "ref_no")).contains($F{query_id}.toString())[/code]

I'll also combine it with a null check...

$P{ref_no}.isEmpty()?Boolean.TRUE:(((ArrayList) $P{REPORT_PARAMETERS_MAP}.get( "ref_no")).contains($F{query_id}.toString()))    [/code]

 

Note:

  • make sure the brackets are correct as above, else it may throw an error
  • under $P{REPORT_PARAMETERS_MAP}.get( "YOU_PARAMETER_NAME_GOES_HERE")) , make sure you just state the parameter name. Do not use $P{ref_no} in there or it will fail

 

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...