iReport: Setting Parameter Values from Query MongoDB - mongodb

I am fairly new to JasperReports and iReport and am struggling with something, which seems should be basic.
If you use MongoDB then you know it does not support the concept of a 'JOIN'. Therefore, from the iReport main dataset query I want to set a parameter/variable from the results. Then I want to use the collection values I just set in a different dataset as a query parameter/variable (NOT table, or LIST - just a plain old simple dataset I create, which will also query MongoDB as the source).
It seems this would be a straight forward use case, but I don't see anything intuitive in iReport that seems would do this. Can this be done? If so any clues you can give me would be wonderful and greatly appreciated.

Do you want to pass the values as collection from one report onto the other ?
This can be done by writing the following in your filter expression $P{parameter_name}.contains($F{field_name}). Additionally, you need to create parameter with the same parameter_name with class type java.util.collection .
Now this report is ready to receive any parameters as collections. This works for MongoDB as I have tried this out. Now as you have already said that you have been able to send the collection from the main report, the above method will work for receiving the parameter in the second report.

Related

Best approach with Jasper Report

I have a requirement to generate reports in PDF and Excel format. For the same I have chosen Jasper. Now require some help from your side to identify the best approach on the same.
Note - My queries are dynamic in nature.Like in some scenario then will provide name in some scenario they will provide dates not name and in some scenario both.
Approaches I have identified are given below.
We can create data source and query in JRXML and execute the same.But not sure query will be dynamic or not. I am personally not prefer this approach because from java I can pass the connection from pool.
We can pass the query and connection both from the Java side and then Japser will execute the query.
We can query in java and then pass the List of bean to the Jasper for report creation.
Now need some suggestions on the best approach among above and also of any approach suggested apart from the above.
To me, option 3 is best. I did that previously.
For mine, I had a master report containing conditional sub-reports. To do that, I have build sub-report's .jasper from their .jrxml and passed my List of bean so that I don't have to re/compile the .jasper from .jrxml again(My master report was in .jrxml and condition for sub-reports where set there).
Another advantage is, you don't have to change your jasper files if you want to change your logic in query level-just leave them untouched once done.
So, I think , option 3 is good to go.

talend how can we estimate taggregateSortedRow recordcount parameter value

We are trying out talend and we wanted to aggregate some sorted data on few keys .
Simple enough but when we try to use taggregatesortedrow its asking for Exact number of rows to be specified.
I am not sure how any one can input this on the fly. Dosen't this value change for every run ? am i missing something. surely they cant expect us to know total recs before we run the job.
This has to do with the way in how the Talend component tAggregateSortedRow is programmed. To avoid it omitting data you need to provide the record count. There are a few users with the same question like you asked:
https://www.talendforge.org/forum/viewtopic.php?id=50094
https://www.talendforge.org/forum/viewtopic.php?id=54231
https://www.talendforge.org/forum/viewtopic.php?id=7641
which I found simply by using Google.
Anyway, if you need to do sorting and aggregating, consider using the components tAggregateRow and tSortedRow separately. It should work fine.

Dynamic parameters in Tableau

Looking for a solution to dynamically update the parameter in tableau, so that it populates new/changed values, automatically, once the data is refreshed.
Just fyi, Currently, my parameter is getting values from a field which has got date values in string format(for eg: 2016Q1).
Request help.
This is not currently possible without serious XML hacking and scripting. There have been multiple requests for this feature from Tableau users, and it might be added in the future.

Would anyone explain me how to add a data source to a "part" of a Report Book?

I am trying to add a data source to a "part" of a Report Book. Or I should say passing the information to the fields on that "part" of the ReportBook( or why not, the Main Report). I have come to realize that this is not exactly how things were done with MainReport and Subreport(s). This is a new concept of jasper 6.2.0, so is not exactly the old known subreport and traditional way of doing things(or is it? Do not know..., please if you don't main, explain that too, thanks).
I have read a lot of examples out there ( see one here), of how to pass data source through jasper parameters and then, utilize those parameters referenced in , but it does not seem to be the same way when working with "parts" of a Report Book.
I can provide more information, but essentially what I need is to pass that data source to the part, that refer to my other report (or subreport if you will) named Content.jrxml, so the other report can print/render the right information of those fields. This report contains fields and no information is passing to those fields there went I print the Report Book to pdf. those fields are showing as null.
However I am able to pass parameters successfully is just with passing the fields values and the data source in general, which I have a problem
Does anyone have done or deal with this before or knows of a good example/tutorial that could point me to the solution?
Please help me, I don't know what else to do :(
Thanks in advance!
Sorry, it took me a long time to post back. I find a solution after Theodor (Jasper API main author give me some insights) and here is it!
So, for the Jasper Report engine to handle multiple data sources passed to the report, you have to take into account 2 essential things:
First, for every data source that you want to pass to the Report, you will need to create a new instance. Jasper engine consumes each data source iterating over all the elements in it. When it gets to the next page, there won't be any data, fields or information to read from and fill up the fields on that particular page. Therefore, information won't show up (null) or "blank", depending on the report template configuration.
Last, make sure you pass a new JREmptyDataSource() when filling the report and pass the data sources instance as parameters, and later as sub-parameters for each individual page. Like this:
jasperPrint = JasperFillManager.fillReport(jasperReport, jasperParameter,new JREmptyDataSource() );//new JREmptyDataSource()
That way main report, or the wrapping report (the book), does not use any data source of the pages instances (if it does not need it, of course) and each page will get a data source, through the parameters.
Ultimately, on runtime, it the page of the book can consume individually each data source without affecting each other.
Let me know if this makes any sense?
Thanks

User Defined Aggregates in JasperReports

I have a requirement in JasperReports: The user wants to dynamically select a set of columns, or a set of rows in the published report in the browser to calculate any aggregate like sum, count, etc (similar to Excel).
I am currently using Jaspersoft Studio and JasperReports Server v6.0.1. I cant find much help in my internet research and not sure if this is doable. Is this possible to achieve, If so can you please guide me through.
It is possible to generate dynamic columns using crosstab element of jasper reports. You will then have to create list of data objects(JRDataSource).
In my case, all the aggregation was done on the server side and passed the value as a parameter using a hashmap .