Syriusz Posted November 10, 2019 Share Posted November 10, 2019 Hi,My client wants to create Report in Jasper witch pass parameters to java application. Is is possible?I know how to make it in other way (from java to jasper). best regards Syriusz Link to comment Share on other sites More sharing options...
C-Box Posted November 14, 2019 Share Posted November 14, 2019 Well sometimes I also needed some results from the generated report back in my calling (java)application. So there are several ways to do that.First you can create a scriptlet class where you implenent the different methods to collect some values in your scriptlet class. (e.g. some sums or some averages from total summary band or whatever). After the report is finished with the fill process you can reuse the scriptlet object to do some further work.Second approach I've sometimes done is to parse the generated JRPrintObject (you can iterate through all pages, through all elements) and can get some values from special fields or whatever -> just mark them with unique keys or url anchor expressions or whatever else). So this is also quite a simple way to get something back from your report.Of course you can also use some Exporters (CSV/EXCEL/TXT/....) to get the data back in a programmatically way to interprete them further.So nothing is impossible... the limit is the sky ;-)hth + regardsC-Box Link to comment Share on other sites More sharing options...
Syriusz Posted November 22, 2019 Author Share Posted November 22, 2019 Thank You for your response:) What do you think abour webscraper?Or smothing like this https://community.jaspersoft.com/documentation/jasperreports-server-ultimate-guide/v55/creating-custom-data-source#datasources_3486546327_1092417 ?? Link to comment Share on other sites More sharing options...
C-Box Posted November 22, 2019 Share Posted November 22, 2019 Not sure what you actually want to get back from your generated report to your calling java app???So of course you can also use some webscrapers (I've no experiences with such tools) and extract content from generated (html) content. Also the CustomDataSource that wraps your ResultSet/Data could be an approach... so that's why I wrote nothing is impossible... it depends what exactly you want to do?Like I said: for just getting some calculated sums from JasperVariables in some bands the scriplet or parsing the JasperPrintObject way would be the easiest was (IMHO)regardsC-Box Link to comment Share on other sites More sharing options...
Syriusz Posted November 25, 2019 Author Share Posted November 25, 2019 Firstly, Thank You for your patience :) My Client wants something like this:1. User go to jasper server, choose raport "X" and input parameters like ID or "version of report"2. Jasper pass paremeters to Java Application "Y" 3. "Y" take paremeter like ID and collect data from others systems in Client network. Something like "Select * from SomeTable where id = Input_ID4. "Y" insert all collected data to database "DB" and finish work5. Report "X" starts to generate report from "DB" with new dataIs it possible? regardsSyriusz Link to comment Share on other sites More sharing options...
C-Box Posted November 28, 2019 Share Posted November 28, 2019 Well I'm not so familiar with the JasperReportsServer as I normally just use the default JasperReports Library within "normal" JavaApps. Sorry!But I could imagine something like this:Report1 is just responsible to get the parameters from Usera ReportScriplet for Report1 is responsible to pass the parameter to your JavaApp that fills the data synchronous by the passed through parameters into the database (so report1 will take a while e.g. AtReportStarted-EntryPoint ( beforeReportInit() ) of scriplet until the JavaApp finished the preparation of dataReport1 contains a SubReport( so this is Report2) that actually just collects these Data from the currently filled Scriplet class (you could return a different Connection or perhaps a (Custom)JRDataSource instance if needed) and returns the results to the UserSo just an idea.... but perhaps you can do something other with built-in features in JasperReportsServer that I don't know. Looks also a bit of "AdHoc ETL" !? :-)Perhaps a Staff member or a JasperReportsServer PowerUser will answer this topic also??!??hth + regardsC-Box 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