babs Posted October 22, 2008 Share Posted October 22, 2008 Hi All,I have created report 1 and report 2. Both have different SQL queries. Report 1 has a column called CustomerName that I made as Hyperlink. On click of Hyperlink CustomerName, I want a report 2 to open, after successful execution on SQL in report 2.I have everything working except --- not able to pass the CustomerName value to report 2 SQL query.report 2 SQL query has where part as ...... WHERE customer_name = $P{CustomerName}This $P{CustomerName} is just not getting the value say IBM when customer clicks IBM hyperlink in report 1like the report 2 query should become like WHERE customer_name = 'IBM' kind of thing.What is the way in IREport 3.0 to pass parameter value from Report1 TO SQL query param of report 2 ??What wizard steps can do this ?thanks again,keshub Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted October 23, 2008 Share Posted October 23, 2008 Not sure how you generate the report2, but I suppose you have some kind of server that takes care to generate the second report. Then I suppose this url will take a parameter (CustomerName?) so you have to pass this parameter in the url (or let jasperreports to add it for you declaring an Hyperlink parameter.Then the responsability of passing the parameter to the report2 is up to the code you use to generate it.JR alone has not drill down capabilities, you need a backend app like JasperServer, or your one.Giulio Link to comment Share on other sites More sharing options...
babs Posted October 23, 2008 Author Share Posted October 23, 2008 Not sure how you generate the report2, but I suppose you have some kind of server that takes care to generate the second report. " "BOTH reports generated using "Report Wizard" of IReport 3.0 Both reports are in seperate "Report Units" Both report has their own SQL statements I put during wizard. Both report inits compile success within Ireport and also get uploaded to JasperServer. "" Then I suppose this url will take a parameter (CustomerName?) so you have to pass this parameter in the url (or let jasperreports to add it for you declaring an Hyperlink parameter. ""Yes used Hyperlink parameter and created 2 additional parameters using IReport wizard so CustomerName and report2 unit does appear in URL. Actually it also open report2 on click of hyperlink. except the report2 says "the report is empty" Then the responsability of passing the parameter to the report2 is up to the code you use to generate it. "As I said, Since I used IReport wizards to generate both report units --- I DO not have my own java code. Thought my own code is NOt needed since I am using WYSIWUG IReport designer and Jasper Report" JR alone has not drill down capabilities, you need a backend app like JasperServer, or your one. "Drill down/Hyperlink I implement using help from book --- definative guide to Ireports I DO have JasperServer where both report units are sitting at this point" tomcat is my web server. "" My report2 SQL where clause $P{CustomerName} is not getting the real value say ..... "IBM LIMITED" and hence report2 keeps showing empty. Thats the issue. Hi Giulio,Thanks for your response. I am using IReport 3.0, JasperServer and Tomcat.a>Created Report1 and Report2 using IReport's "IReport Wizard". Both these reports are in seperate REPORT UNITS. In wizard I put the respective SQLs. My Report2 SQL does have the ............ WHERE CustomerName = $P{CustomerName} the value 'IBM' or 'Sun' or 'Oracle' etc I am expecting to provide from Report1's CustomerName --- Hyperlink column click.I used the "Hyperlink" tab ------ "Self" ------ "Report Execution" and in Link Parameter tab added two parameters _report as "/reports/samples/report2" and CustomerName as $F{CustomerName} In report2 "Add Value Parameter" defined parameter as Parameter Name as CustomerName and Default Value Expression as ""Hoping this is the parameter I have in Report2's SQL as $P{CustomerName} and it would noe get its value from report1 hyperlink.b>I compiled both the reports in IReport. Compile successful. !c>So each of these report units, I right click and "Run Report Unit". Both reports now go sit in the Jasper Server repository.d>I go JasperServer UI and then open my Report1 from repository. It opens successfully. Then in column1 I notice Hyperlinks show up like IBM Oracle HP etc so i click say IBM hyperlink. This click opens the Report2 with the URL in the browser of JasperServer showing up as follows........................................ http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=%2Freports%2Fsamples%2Freport2&CustomerName=IBM+LIMITED&_eventId_drillReport=&_flowExecutionKey=_c6F8AD19C-001F-3214-D548-CD9EF0BA6E21_k039A41B2-C696-C776-F942-F1AFD14EC883&reportLocale=en_US Please notice in above URL, report2 and CustomerName is correctly constructed. It also opens the report2 in the JasperServer browser, but unfortunately its shows "The report is empty."UPtill now I am happy, the FULL circle from report1 hyperlink click to opening the report2 in jasperserver is succeesful ---- EXCEPT report2 is empty. I know why it says empty. REASON is ------ report2's SQL WHERE clause is just not getting that "IBM LIMITED" value (either from the URL OR whichever other option/wizard etc might be. I just dont know, what is the way you can transport the parameter value between 2 report units and be able to supply to SQL param$P{CustomerName} ???? Now can u please help me how to solve this last part of puzzle using IReport JasperServer combination ? Most important point is both these reports are in two seperate Report Units.If this is resolved then I am going GOOD !!!thanks,keshub Link to comment Share on other sites More sharing options...
babs Posted October 23, 2008 Author Share Posted October 23, 2008 THE url got trimmed in above port so sending again ............. http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=%2Freports%2Fsamples%2Foracletomysqllimit6&CustomerName=FUJITSU+LIMITED&_eventId_drillReport=&_flowExecutionKey=_c6F8AD19C-001F-3214-D548-CD9EF0BA6E21_k039A41B2-C696-C776-F942-F1AFD14EC883&reportLocale=en_US Link to comment Share on other sites More sharing options...
babs Posted October 23, 2008 Author Share Posted October 23, 2008 Thanks to All. I got this working. Now what I have is Hyperlink in report1 that generates a correct URL with parameters and then calls the report2 (located in seperate Report UNit) and parameter from report1 is passed to SQL $P of report2 VIA URL. I have a real dynamic hyperlink working !!!! that was so cool !!! Link to comment Share on other sites More sharing options...
fgar Posted October 28, 2008 Share Posted October 28, 2008 Hi keshub, can u explain exactly what u do...i have follow the discussion betwenn u and Giulio but i'm just little bit newbie on ireport and jasperserver.My scenario it's very similar to your... can u post the 2 report in way that i understand the right way.I have followed what u describe but sincerally i cannot go on due to error....thx Link to comment Share on other sites More sharing options...
babs Posted October 28, 2008 Author Share Posted October 28, 2008 Hi Fgar,my case was, I had a hyperlink(drilldown) on report1 and say user clicks on hyperlink "xyz inc" then i have report2 that will show the correct records for xyz inc. bcaz in report2 i have a where clause like ......... WHERE companyname=$P{CustomerName}so the challenge i was facing was how to pass that "xyz inc" to report2 SQL where clause. so the key is, in report1 u have to have a correct URL that will get invoked after hyperlink click. rightclick the hyperlink ---- Hyperlink tab ---- Self ----- Report Execution --- Reference"http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/samples/oracletomysqllimit6&standAlone=true&ParentFolderUri=/reports/samples" oracletomysqllimit6 is the reportunit name of report2 Sililarly under Hyperlinktab --- Link Parameters tab ---- give yours as -- CustomerName and $F{CustomerName} similarly TextField tab ----- java.lang.String (since mine parameter is string) ---- Now --- $F{CustomerName} Now select report2 "Input Control" in ireport repository and right click ----- "Create a new input control" give CustomerName every where under General tab and then under "Input Control details" tab select "Single Value" and check Mandatory checkbox.Now report two you already must have query ....... WHERE companyname=$P{CustomerName}. compile both reports. and then rigth click "Run both Report Units". Now both are sitting on JasperServer repository.Run repot1 in server, click hyperlink, that will pass the clicked value to WHRE clause of report2 and that SQL gets executed and you have report2 displayed with correct records.boom you have drill down working. !!!!!!!!!!!!remember CustomerName is ur hyperlink column in report1 that appears on report1 (in design mode). and its case senssitive where ever u pass it. so take special care as u reference it throughout. remember I am using IReport 3.0 version. check urs.hope that helps. Enjoy !!keshub Link to comment Share on other sites More sharing options...
mbyanfei Posted October 29, 2008 Share Posted October 29, 2008 keshub,i was trying to follow your instruction on creating a drill-down report, but failed. Eevn though I put something like"http://localhost:8080/jasperserver-pro/flow.html?_flowId=viewReportFlow&reportUnit=/FCI_BI_Dashboard/bi_dsh_inventory_detail&standAlone=true&ParentFolderUri=/FCI_BI_Dashboard"in thehyperlink ---- Hyperlink tab ---- Self ----- Report Execution --- Reference,at runtime, it doesn't invoke it, instead it invoke a URL which was randomly generated - something likehttp://localhost:8080/jasperserver-pro/flow.html?_flowId=viewReportFlow&site=FCI&_eventId_drillreport=&_flowExecutionKey=_cA640........................&reportLocale=en_USDo you know why? Link to comment Share on other sites More sharing options...
mbyanfei Posted October 29, 2008 Share Posted October 29, 2008 by the way, the error message I got is: Error Message: Null URI com.jaspersoft.jasperserver.api.JSException: jsexception.null.uri com.jaspersoft.jasperserver.api.JSException: jsexception.null.uri at com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryServiceImpl.findByURI(HibernateRepositoryServiceImpl.java:572) Link to comment Share on other sites More sharing options...
npatki Posted January 7, 2009 Share Posted January 7, 2009 Hi, this did not work for me. IT gives error as NULL URI. Also , date parameter could not be passed to child report. Can you please put complete URL you added as Reference? Link to comment Share on other sites More sharing options...
npatki Posted January 22, 2009 Share Posted January 22, 2009 Hido you have any idea about how we pass a collection to a hyperlink parameter?ThanksNikhil Link to comment Share on other sites More sharing options...
rongrajo13 Posted March 25, 2010 Share Posted March 25, 2010 First, get the url of the 2nd report you want to target, like this:http://localhost:9090/jasperserver-pro/flow.html?_flowId=viewReportFlow&ParentFolderUri=/reports&ndefined=&standAlone=true&reportUnit=/reports/testLinkthen in the hyperlink tab set the hyperlink type into reference then add the name of the parameter at the end of the url like this:"http://localhost:9090/jasperserver-pro/flow.html?_flowId=viewReportFlow&ParentFolderUri=/reports&ndefined=&standAlone=true&reportUnit=/reports/testLink&EmployeeID="EmployeeID is the parameter in 2nd report...then concat the field where you would get the value for the parameter like this:"http://localhost:9090/jasperserver-pro/flow.html?_flowId=viewReportFlow&ParentFolderUri=/reports&ndefined=&standAlone=true&reportUnit=/reports/testLink&EmployeeID=" + $F{UserID}then paste this in the hyperlink reference expression...my ireport version is 3.7 ... i'm not sure if this will work on your versions but, it works fine on my version... Link to comment Share on other sites More sharing options...
saharhassan Posted March 6, 2012 Share Posted March 6, 2012 "and then rigth click "Run both Report Units". How can I run both report units and where exactly to right click? I am using Jasper Server 4.5.0 Post Edited by xaharhassan at 03/06/2012 05:43Post Edited by xaharhassan at 03/06/2012 05:45 Link to comment Share on other sites More sharing options...
apoorve.t Posted April 14, 2014 Share Posted April 14, 2014 I have exactly the same requirement as Keshub, but am using jaspersoft studio 5.5.0? How to hyperlink there? Link to comment Share on other sites More sharing options...
joel.carlson Posted August 19, 2015 Share Posted August 19, 2015 I will try to explain this for you just in case it will help someone else that is new. I have two reports one called MLR and one called MLR2. The main report, MLR, shows employee info, like empno, firstname and lastname. MLR2 has the employee's detailed information with address, phone, etc. In MRL, or main report, I used empno for the variable to pass. So in the main report I make a parameter of EmpNum that is equal to $F{EMPNO} Then I right click on empno and select hyperlink. Hyperlink target is set to self Hyperlink type is changed to Reference On the reference tab add the url to the second report, in my case it is MRL2. Go to your jasperserver and open the second report and copy in the url like "http://linktoreport/MLR2&EmpNum="+$F{EMPNO} You can see I added EmpNum, the parameter to the end of the url with &EmpNum=" then added the field to be passed to the second report. So before the quote add &Parametername= Then after the quote add +$F{whateveryourcolumn name is to be passed} On the Link parameters tab add EmpNum for name and $F{EMPNO} for Expression Save that and upload it to the server Go to your second report and add and input controls, for me it is EmpNum all the way through for the names. Now when you run the first report it passes the employee number to the second report. 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