Multiple Subreports with a subreport passing value to other - c#

I'm using Report Viewer at C# in WinForms. I have 3 database tables: Equipament, Sector and History, I also have 3 Report.rdlc, The MAIN is the ReportEquipament and the other two subreport are ReportSector and ReportHistory. I already know how to fill the ReportSector, what I want to do is to pass the idSector from the ReportSector, so I can call a procedure at the SQL Server database and search all the History with this Sector ID, and show the data at the ReportHistory. I have no idea on how to do it. I new with ReportViewer and this is my first time doing Reports.
PS: I know how to do the procedure, just don't know how to use it.
Thanks.
Jonas.
Let me try to explain better:
I search for a specific Equipament, and that Equipament passed for many Sectors,
and while he was at this sector he had problems, and this problems are related to
the Sector.
What I want is something like that:
Equipament: X
Sectors: (Here the ID of the Equipament is passed to find the Sector that he has)
Sector: X (here the ID of this Sector is passed to the Subreport "Problem")
Problems: (with the ID of the Sector I search all the problems at this sector)
Problem: X
Problem: Y
Sector: Y (here the ID of this Sector is passed to the Subreport "Problem")
Problems: (with the ID of the Sector I search all the problems at this sector)
Problem: X
Problem: Y

Okay after rereading you're question and understanding what you're asking here is how I have solved similar problems with SSRS. If you have the id variable at the time you load the main report (not subreports) then all you need to do is to pass that parameter into the main report and access it via the sub report.
Look here: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/92ea8f6b-ad27-42b9-a673-72ee9ce2d1fc/how-to-pass-parameters-to-ssrs-sub-reports?forum=sqlreportingservices
And here: http://technet.microsoft.com/en-us/library/ms160348(v=sql.100).aspx
If instead you need to run the main and first sub report first and then get an ID, you're most pain free way of doing this is to run one report and then have the user enter in more information to run a second report. If you really really want to make it so that can interact with the report
Look here: http://sqlserverbiblog.wordpress.com/2011/02/14/can-i-add-controls-to-a-reporting-services-report-3/

If i am not wrong you getting problem in parameter passing in sub report. Here is the link for that

Related

Saving SSRS multi select parameter value with wildcard

I have searched and searched and have not been able to find the answer to this. I'm no stranger to SSRS, .Net (c# and vb.net), SQL, etc...been in it for years. I currently have a multi-select report parameter that is populated by a dataset in my report. There are hundreds of entries, so I built it to be driven by a wildcard character in a preceding parameter. Everything works fine right now. My question is this: is it possible to enter a wildcard value, select one (or more) of the filtered values and then store that/those value(s) on selection so that a user can go back and enter another wildcard value and select from a newly filtered list? (Basically, remember what has been selected in the overall dataset before report execution and create some sort of comma-separated list as the final parameter value to be passed to the report) I realize this may be better served in a web app w/a reportviewer control, but I'm trying to avoid deviating from the native SSRS server if possible. Thanks in advance!
The way I might approach this (not actually done it but the theory sounds ok)
Have 2 parameters for user input, your current one and a hidden one called say #filter (visible) and #filterHistory (this is the hidden one)
Have a textbox (formatted like button) with something like "Refine" as the text. Set the action to call your report again but set the #filterHistory to be something like #filterHistory & ", " & #filter. Basically we keep appending the last user input to the history.
Then your report would filter based on both parameters. You'll have to do some parsing of the delimited parameter now to split it out into the constituent parts but you get the idea.
I've no time to build a test report but hopefully that will point you in the right direction. If it doesn't help or work then comment and I'll see if I can knock up a quick example.

Crystal Reports and multiple tables

I'm using C# and Entity Framework.
I created the dataset to display data from it:
With only one table(buildings), i created my crystal report very well.
But now, i want to create another one that display:
name_b, Adresse_b,date
the number of appartements of a building
the number of shared_areas of a building
and the name of the user.
I have to write a query in the crystalReportViewer1_Load and set it as datasource or what?
Thank you to help me.
There are a few options -
1. In your current report, group the report by Building, then
create a sub-report containing all of the details (name,
address,etc) and place it into the group footer in the main (outer)
report. Link the report by ID_Building. This will show you all of
the details for each building.
2. In you current report, add all of the tables to the data connection (database expert); then group the report as desired (by building, Apartment, etc).
You can create running totals to get the count of apartments and the number of shared_areas.

Crystal Reports for Visual Studio: display 2 unrelated tables

I ask for advice what would you suggest to display 2 unrelated tables in a single report (if needed with subreport), the first one with groupings and the second one "flat"?
Details:
I am developing a report with C# 4 and Crystal Reports for Visual studio.
Data comes from a Stored procedure in Sql Server 2005, that returns 2 tables.
I pass the data to the report with the .SetDataSource(Dataset) method and I checked that data in the dataset is correct.
I need to display the data from the first table in a quite complex form with different sections. This part works.
At the end of the report I need to print the data from the second table (no grouping, just a "flat" print). To do this I added a subreport.
The tables are not related. I added a Dummy field on them with the same value and used it to mimic a relation in the database expert; I configured the subreport link, based on the dummy field.
I have 2 problems.
The data in the main report is cross joined with the second table (I could expect that since they are related with a constant field)
The subreport is always empty (I checked several times that its table in datasource contains correct data).
I tried different configurations of link and tried to place the subreport in different sections (It should be in the report footer).
I set a border around the subreport: the border is printed but inside it is empty.
I also setup a formula to count the records of both tables and put the count in the report: the count is > 0 for both.
Your approach looks wrong.... At first if both are not releated I don't see any use in creating a dummy field and linking tables which will always provide cross join. Any way as per your descrition table 1 data is saperately displayed and table 2 data is saperately displayed
As per your description in main report you need data from table 1 and in footer you need data from table 2.
Try this approach:
Don't link tables
take table 1 in main report and show the required display.
Take sub report and in that take only table 2 and display in footer and make sure don't link main report and sub report nor link two tables.
Ideally speaking, without linked table not used in crystal report as reporting tools used to display the relevant data based on our criteria and display 2 different set of data without link does not mean as a report as well as tough to integrate in crystal report.
Tough to integrate means at any point you have to link the table either via union in sqlserver or at crystal report side, other wise it display as Cartesian.
As per my thoughts you can do it by some approach.
Approach 1 : You can get the data by union or unionAll with set of columns and filter the data where table's column does not have null value ie.
http://www.maximumimpactsolutions.co.uk/blog/comments.asp?bd=118
Table1col1 Table1col2 Table1col3 Table2Col1 Table2Col2 Table2Col3
value value value null null null --table1data
null null null value value value --table2data
Approach 2 : Second is sub-report, but still need the linked as you already done. But there is proper rule to be set (this is very very tedious job).
Approach 3 : Generate 2 report at c# side and merge into one PDF, then export it.
check this links.
Reporting on multiple tables independently in Crystal Reports 11
http://www.tek-tips.com/viewthread.cfm?qid=241195
http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=4756
http://www.codeproject.com/Questions/348959/Crystal-reports-for-multiple-tables

Automatically inserting value from another table in lightswitch

I am creating a desktop, C# application in Lightswitch. I have a DB file with a table called Reports and another table called StatusList. There are going to be 3 options in StatusList table - Unresolved, In Progress and Resolved. The Report table has a couple of not important fields and a field "Status", which is supposed to hold one of the three values from StatusList table
Now, when the user will create a new Report, I need the application to automatically insert the "Unresolved" value as the "Status" without user being able to change it.
I have tried using this method
partial void Reports_Created()
{
this.Status = "Unresolved";
}
but it is not working. I guess it is because I am trying to assign a String value to the field which is populated from another table.
I am using Visual Studio 2013 and this is my first Lightswitch app as well.
Thank you in advance for any help.
It sounds like your trying to pass parameters between screens. Beth Massi does a good job explaining how to achieve that in this video. And here is another MSDN link to a similar question
Shouldn't your code before like:
This.report.status = "Unresolved"
I.e. The report entity is not referenced by "this" (that refers to the screen).

ReportViewer grouping header in report header section?

Hi, I'm working on a report which uses reportviewer in VS2010.
It is an invoice report. It has some accounts in the system, for each account, it has some orders. Now, in each month, we need to send the invoice to each account.
In the report, at the top, we need to list "Bill To" (the address for each account) and "Invoice#", for each account, it is different, and it is continouous. Then, at the center, it should list the details of the orders for this account. Obviously, each account should have an invoice.
See the attached screen shot. I used grouping and created the invoice shown in screen shot.
But, it has a problem. The "Account address", "Terms", and "Invoice #", I could not put them in the grouping (those are the same within the group). Thus, for different groups, they are shown as the same values, although in the rdlc file, I put their fields there.
Anyone knows how to solve the problem?
One possibility is: instead of creating the invoice for all accounts in one report (i.e. 20 pages, each page is an invoice for an account), create a report for each invoice for each account (so total 20 files), then print the invoice directly. This will work since we can manipulate all the data, and use reportviewer parameters for Account Address, Terms, ...
However, it means we could not browse the reports before print (withint the software). Any suggestions?
thanks
reader
What you can do is , since for each account there is an address, invoice# and invoice details or orders in your case,
So what you can do is :
EDIT : Let me go in some detailed fashion ! (Please zoom in to see the image details clearly)
1.Create a new report and add a Tablix to it
--Tablix has the property , it can iterate through your data
and create dataset which will get data for Account address, invoice, and Terms. Then :
if you are not able to view the image properly ..here is the same presented for you
This is the way I did my reports with similar requirements...sub-reports would ease the tasks to a much extent ..
p.s:
Edit: No need to go for a Header.. as you say in your subject of question.
jus the main report and a sub-report should do what you need !
I jus saw yours is crystal report.. but the concept is over all the same

Categories

Resources