pass field value to subreport or list - jasper-reports

I'm working with jasperreport 6.5.1, I wanna display in each page the employee details and the list of the visited addresses.
I have 2 tables employee {id, name, firstName...}andvisited_addresses{id, name, id_emp...}
I tried firstly to use a jasper sub_report element but I didn't found how to pass the id of the employee who I wanna get his visited addresses
then I tried to use the list element, but I'm struggled with the same problem.
How can I pass the id field to my sub_report or my list?

It is possible to select the employee id with the query in your main report and then add it as parameter to the subreport.
The solution explained here - the version of iReport should not make a difference.
Basically it says:
Click on sub report. in the properties section got to parameters. and add the parameters which you want communicate through main report to subreport.

Related

Crystal Reports - Subreport with stored procedure as datasource creates a new param and doesn't pass it to the stored proc

Using Crystal Reports XI, I have a main report. In this report, I have a Formula Field named XXXCompanyFilter. This is set programmatically at run time and I want to pass it to a subreport.
I add a subreport that has a stored procedure as an input parameter. The parameter is named #co.
A Parameter Field is automatically created in my subreport called #co.
I return to my main report and right-click the subreport and choose Change Subreport Links. I choose the Formula Field XXXCompanyFilter from the Available Fields list and move it to the Field(s) to link to: list.
At this point I expect to be able to choose the subreport's #co parameter in the Subreport parameter field to use: drop down, but it is not there. I have unchecked the Select data in subreport based on field: checkbox.
I've tried selecting the ?Pm-#XXXCompanyFilter option, and that (I think) causes a new subreport parameter to be created:
After that, I do get the new subreport parameter to show in the drop down:
However, this new parameter doesn't seem to do anything, and I'm still prompted to enter the #co subreport parameter whenever I run the report. If I enter a value for the #co parameter the report returns the data I expect.
I've created several subreports to see if the behavior changes. I've tried it with the subreport wizard and with subreports I've created normally. I always get a 2nd, non-useful subreport parameter and the #co parameter is never set, so I am prompted for it.
I feel like if I could select the #co parameter in the drop down list it would work as needed.
I've checked out multiple SO posts, and I've googled the issue but everything I find says I'm doing it right. What am I doing wrong, or what do I need to do to make the #co parameter available in the drop down?
I solved this by specifying a database field in the Available Fields list when creating the subreport link and following the instructions in my original post.
Apparently it just won't work if you specify a Formula Field in the Available Fields list. I can't find any documentation on this but that's the conclusion I come to after reaching a solution by trial and error.

SSRS report need to show n-time based on dataset rows

I have designed two pages and each page have different table.Currently my dataset return only one user details.So i have bind all details in table.
Requirement
In case data set return two user details ,need to print two user details.First two pages for first user and second two page for second user.
Is this possible in SSRS report? If yes please guide me.
As you already have a report working for a single user then I would normally do this with subreports.
Asumming your current report accepts a userid or similar as a parameter....
Create a new new report.
Add a dataset that returns a list of users that you want to produce the report for
Add a table and set its dataset property to the name of the dataset you just created.
You can remove the header row and all columns except one from the table
In the remaining cell, right-click and choose "insert Subreport"
Right-click the subreport placeholder and choose properties
Choose your original report as the subreport
Click the parameters tab and choose the subreport property name on the left side, choose the field from your dataset that contains the userid (or whatever value you pass as a parameter) on the right side.
That's pretty much it, when you run the new report, it will produce 1 row per user, in each row it will run your subreport.
You will need to use a matrix, specifically row groups, grouping by using user details, and possible inserting a page break between each instance. This should get you going in the right direction.

Multiple Reports with one call/in one PDF

I am just new with Jasper Reports and build two reports like:
First one: Gets as Parameter an Employee-Id and displays all employee details.
Second one: Gets as Parameter a Salery-Id and displays all salery details for a month.
Now I am trying to generate a Report that has as first page the employee details and than all salery reports for all month the employee has worked (and got money...).
So I set "Summary on a new page" to my employee report and add salery report as subreport in summery band.
But how do I call the salery report several times? I assume, I have to get all salery-Ids for the employee and pass them to salery report, but how?
Or am I completely on the woodway to do so?!

How to pass to a subreport the current element being iterated in iReport?

I have a report and a subreport.
How can I pass to my subreport an information of the current element being "iterated" in my master report so that it will populate the query of my subreport?
Example:
I have in my problem an Auction. An auction has a set of Product.
These products will populate the master report. But a Product has another information that I want, which is Company (the company who bought it).
So what I want to do is:
My master report will have a query selecting the Products from a given Auction.
The report must have a subreport that contains other information about each product. How can I give the ID of the current product to the subreport so that it can be populated?
-> Master report: selects Products from the Auction. (is working fine ^^)
-> Subreport : for a given Product (passed by the master report), create a report.
Thanks in advance =D
I found out a way of doing this (pretty logic)..
Just pass to the subreport the field of the datasource being used. Thus, When it iterates in the Detail field, it will get the values of each element in your query.

Calling SSRS report from another report

I an new to working with SSRS and creating reports.
I have created a simple 1 page report from one datasource and 6 detasets.
Report takes one parameter: EmployeeId -- and generates 1 page report for that employee.
So far all good!!
Now, I want to create another report which takes a DepartmentId. This report should generate report for all x number of employees in the department and have x number of pages.
Is there any way I can reuse the report I created earlier (the one with EmployeeId as parameter) to generate the later report I described?
Thank you :)
You could probably use a subreport, if the DepartmentId is available per Employee (i would assume it is) then that would probably be your best bet
How about you inclue the employees department ID on the detail report for the Employee, then you put an action on this field and set as target the department report. Passing the clicked Department ID to the department report and you got a nice solution.