yashdeep Posted March 18, 2009 Share Posted March 18, 2009 Hello!I have a bar chart report with a multi-select input control (say on Country), it works fine. Problems comes when i am opening a report by passing values of multi-select input control to another report using link parameter and that report also contains a multi-select input control on it (on same Country ), here i want to show all those countries selected, those i already selected on main report.In other word i want to set default values for Multi-Selection input control on Child report with the values i selected in main report.(Both reports main and child has a multi-selection input control on Country)I used following syntax to set default value to County Multi-Select input control (of type java.util.Collection) on main reportjava.util.Arrays.asList(new string[] {"INDIA","USA"}) its working fine. Now how to do it for child report while calling child report from main report using link parametersIf any one knows how to do it, pls let me know ASAP. It’s urgent.....Thanks & Regards,Yash Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted March 19, 2009 Share Posted March 19, 2009 You can not.A solution could be an helper class to encode/decode your list. Giulio Link to comment Share on other sites More sharing options...
vishal29bhp Posted April 9, 2009 Share Posted April 9, 2009 Hi Guilio, Can you explain it a bit more. I can write java code for this . Waiting for your valueable suggestions. Vishal; Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted April 9, 2009 Share Posted April 9, 2009 Vishal, are you using JasperServer? Link to comment Share on other sites More sharing options...
vishal29bhp Posted April 9, 2009 Share Posted April 9, 2009 Yes Guilio, I am using JasperServer ,Do i need to add Java Class as a jar Resource .Vishal Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted April 9, 2009 Share Posted April 9, 2009 No extra classes are required, here is the trick:1. Define 3 parameters, in this specific order, let's say:linkParameter (String)inpunControlParameter (Collection)realParameter (Collection)The realParameter is the one you'll use in the report, in the query etc.Set as default value expression for realParameter this expression:($P{linkParameter} != null && $P{linkParameter}.length() > 0) ? java.util.Arrays.asList( $P{linkParameter}.split(",") ) : $P{inpunControlParameter}2. Create an input control for the parameter inpunControlParameter (i.e. a multi-select from a query)3. Create an input control for the parameter linkParameter of datatype text, and make it not visible (if you are in JS 3.5.0)The idea is that the realParameter tries to create a collection from a string if linkParameter has a value, otherwise willget the value from inpunControlParameter.In the hyperlink you need to set a value for linkParameter, it must be a string with the elements separated by a comma (you can use another character) like:item1,item2,item3Hope it is clear.Giulio Link to comment Share on other sites More sharing options...
vishal29bhp Posted April 9, 2009 Share Posted April 9, 2009 Thanks Guilio for your support i will let you know if it worksVishal Link to comment Share on other sites More sharing options...
vishal29bhp Posted April 9, 2009 Share Posted April 9, 2009 Hi Guilio, I tried a lot but i am not getting the values of main report on child report it is showing child report empty.Vishal Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted April 9, 2009 Share Posted April 9, 2009 Checkout the attached file, on my JAsperserver I created for the report unit to run that file 2 input controls, as described in my previous post. Run the report in JR and click on the first textfield (initially you have some null textfields)Giulio Link to comment Share on other sites More sharing options...
vishal29bhp Posted April 10, 2009 Share Posted April 10, 2009 Hi Guilio , Attached are Jrxml file . Plz have a look on these. i am really following your instruction but having no success.VishalPost Edited by Vishal Chawre at 04/10/09 06:15 Link to comment Share on other sites More sharing options...
vishal29bhp Posted April 10, 2009 Share Posted April 10, 2009 Hi Guilio, I am able to get the value but when see the result it only shows the result of the first value. Let me explain this a bit more: Suppose i am sending String "Gent Footwear,Ladies Footwear,Kids Footwear" as link parameter then the child report would only run for the Gents Footwear and thats it ,becoz of Split method split the String by comma I think i am clear to you.Vishal. Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted April 10, 2009 Share Posted April 10, 2009 The jrxml looks ok, but I don't see any link in your jrxml.What about the inputControls defined in JasperServer?How did you define them?Giulio Link to comment Share on other sites More sharing options...
vishal29bhp Posted April 13, 2009 Share Posted April 13, 2009 Hi Guilio, I have created the hyperlinks on chart data.also linkParameter i created are of text type and not visible and inputControlParameter are of multiselect query type. I think if i am getting only one value at second report so there should be a Scriplet at child report which will convert the String into Object []. Plz Suggest me how to do this.Vishal Link to comment Share on other sites More sharing options...
vishal29bhp Posted April 14, 2009 Share Posted April 14, 2009 Hi Guilio, I am able to get the values of linkParameter and convert it into collection but i need to show the selected value of Main report to Child Report . I am using Scriptlet method which is returning collection in Default Value Exprression of inputControlParameter but not getting the desired result.Vishal Link to comment Share on other sites More sharing options...
vishal29bhp Posted April 15, 2009 Share Posted April 15, 2009 Hello Giulio, I am passing multiselect values from Main report to Child Report as link parameter by doing some Scriptlet , tricks. I am getting the desired result . But I need to show the selected values of Main report remain selected to Child Report as well in Jasper . Any Suggestions Plz.Vishal Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now