Jaspersoft Subreport Collection Parameter - Order issue

0

 

I've designed a Main report which consists of following Sub reports

  • S1
  • S2

The above subreports have been placed in Separate Group Headers. Both the subreports have input paramter P1 of type java.collection.util. This parameter was added to Main report as well with same name and Type. When I provide the following Inputs in P1 in Main report

  • I1
  • I2
  • I3 I would expect For the Input I1, the both Subreports S1 followed by S2 should display. Then for input I2, both Subreports S1 followed by S2 should display.

However, in my case Subreport S1 prints first all for inputs I1,I2,I3 and then Subreport S2 prints all for inputs I1, I2, I3.

How do I get the subreports as I expected as above?

P.S I'm using the Jaspersoft Studio 5.6.1

Thanks

Sree

sreerambabu.palaniswamy's picture
Joined: Jun 11 2015 - 9:25pm
Last seen: 11 months 2 weeks ago

7 Answers:

0

Hi,
Since you are using a collection parameter, the query executes once for all the values of the parameter. 
I would suggest you use integer/string parameter and generate the report once for I1, next time for I2 and the third time for I3.

Regards,
KKriplani

kkriplani's picture
837
Joined: Sep 4 2015 - 2:18am
Last seen: 1 year 2 months ago
0

Hi Kriplani,

Thanks for your reply. Actually I'm trying for Multi value parameter as input.

Could you please explain more on 

"I would suggest you use integer/string parameter and generate the report once for I1, next time for I2 and the third time for I3."

as I couldn't follow?

 

 

 

 

 

sreerambabu.palaniswamy's picture
Joined: Jun 11 2015 - 9:25pm
Last seen: 11 months 2 weeks ago
0

Reason why you are getting that input is because while the query of the subreport executes, the input values for the collection parameter go together. example:

select * from table_1
where p_para IN (2,3,4);

This query is bound to return a single result sets with multiple rows or column depending on the fields.

While if you don't use a collection type parameter but instead use java.lang.integer type, you can achieve different query sets. Example;

Instance 1: when you enter the value of parameter as 2

Select * from table_1
where p_para = 2

which will return a result set, i.e, S1, S2 and S3 executes for value 2 (I1)


Instance 2 & 3 : Similarly next run the report for 3 and 4 values of p_para.

Here your requirement would be achieved but only at different instances. 

kkriplani's picture
837
Joined: Sep 4 2015 - 2:18am
Last seen: 1 year 2 months ago
0

Hi,

Thanks for the reply. But my requirement is to pass the multiple input in same parameter. I couldn't acheive it using just the integer.

Let me explain, the end user inputs by selecting multiple project name in the filter section of the report. These values have to be used together as collection type to get all the results in reports. Above solution is only for Single input. Is there any other way I could use for Multi input parameter  instead of collection to acheive my requirement?

Thanks

 

Sreeram

sreerambabu.palaniswamy's picture
Joined: Jun 11 2015 - 9:25pm
Last seen: 11 months 2 weeks ago
0

    can you change the sql command in subreport and pass all possible value like this 

    select * from test

     where test.chekvalue=$p1 or test.chekvalue=$p2 test.chekvalue=$p3 ......

    the parameter $p1, $p2 or $p3 cant contain data or not 

 

costakygo's picture
Joined: Apr 28 2016 - 9:05am
Last seen: 2 years 10 months ago
0

Hi,

No, couldn't do. As there are nearly 1000 projects. I couldn't assume how much a user will select as the input.

sad

sreerambabu.palaniswamy's picture
Joined: Jun 11 2015 - 9:25pm
Last seen: 11 months 2 weeks ago
0

Any help???crying

sreerambabu.palaniswamy's picture
Joined: Jun 11 2015 - 9:25pm
Last seen: 11 months 2 weeks ago
Feedback