bind field at run time Crystal report - vb.net

I want to create a column on a crystal report. I am binding crystal report to .net class object collection at run time. Now one of the columns I need to bind to the object collection property which is another object to it’s property.
How do I do this ?

domain of the qustion is not that cliear.
if the object what you need to display in the report is not in the detail section of the report you will be able to pass this as a parameter.
if this is not not working for you. create the report based on a xml schema. and genarate the report based on that schema.
http://vb.net-informations.com/crystal-report/vb.net_crystal_report_from_xml_file.htm
http://www.codeproject.com/KB/cs/xmlcrreport.aspx

Related

How to pass data from DataGridView to table in ReportViewer without Database or Dataset

I have a few DataGridView tables which user fills (I don't use any Dataset or Database here).
I need to pass them to ReportViewer, I want exact the same tables in report as in a form, no changes at all.
I tried something like this, but it's not working:
Dim rds As New ReportDataSource("rds1", Form1.dgv1.DataSource)
Me.ReportViewer1.LocalReport.DataSources.Add(rds)
and in report1.rdlc added a table and set it dataset name to rds1 but it generates error
The table ‘table1’ refers to an invalid DataSetName ‘rds1’.
So I guess I need to make a DataSet from my DataGridView tables.
How would you suggest me to do that? Otherwise, is there any simpler way to pass the table to report?
You should add a DataSet to your report .rldc Data Sources list and drag and drop the columns into your report element (table, tablix, list etc.)
Remember you can add any kind of object from your project to your report as Data Source (basically any Public Class you create). The imported names and types will be taken from the class properties.

What do multiple reports listed in a single SSRS report mean?

I have one SSRS report like following (image)
I'm new to SSRS; what does this report mean?
If I need to change any parameter value for this kind of report, do I need to go to every report and change the parameter for them individually?
Question:
What does this SSRS report mean?
Answer:
Portfolio dashboard = Main report
Portfolio_XXX = all 8 are subreports.
The subreports may or may not link with the main report. To find the report link, you can right-click on the subreport (gray) then report link.
Question:
Do I need to go to every report and change the parameter for them individually?
Answer:
If you are changing parameter name/type and subreport are linked or use parameter to filter the data, then YES you have to change in main report and subreport.
If all of your reports use same parameters then you only need to make changes onto main report, but if sub reports have their own parameters then you should change main report as well as sub reports parameters.
You have two ways to change the parameter of any SSRS report.
At the design time: When you are designing your report you can set the input parameters in report. You can provide a default value or you can leave this part if you are not willing to provide default parameters.
At run time: When you preview your report or view report in browser, then you can provide parameters if that reports is parametric. You can change the parameters here.
Please note that, if you have provided default parameters and you view report in browser/preview then it shows the default parameters.
You can use subreports if all reports are expecting the same parameters. If not is is best to go another route. I've only had to use one subreport for recent projects.
This is one of main features of sub reports to be able to use same parameters for all of them, so most likely they are the same, but final call should be made upon complete review, including any expressions involved. M

How to change the parameter type in crystal report of the existing report?

I have a crystal report with 2 subreports. The type of the one of the field got changed in the database from number to string. The main report has no parameters but the subreport has this parameter. Now when I try to run the report I get the error in the record selection formula. A string is expected here. My question is How do I make the type change for that field so that I can run my report. ?
Easy to do. And FUN, too!
Assuming you can change the link to the subreport, you can:
1) create a formula to manipulate that field in the main report, explicitly converting it into the format you neend. Then,
2) use THAT formula as the link to the subreport
Should work a charm, "Bob's yer oncle", and all that.
The solution was to remap the bindings of the report with the changed datatype in the dataset

Using Subreports in Crystal Reports in vb.net

I have used 2 sub reports in my crystal report. Both these reports are from separate tables having no connection between them...I have inserted these reports in the details section....I have used dataset to pass source data to these reports...But when i view the report, the sub reports' data isn't filtered according to the dataset rather all the rows are shown in the reports.. How can i get rid of this problem....i just want to view the data like if user wants to view a report for 2011 then it should only show information from the database records having 2011 as the Year part...Can anyone help me on this
The solution to your problem is dependent on how your user specifies the criteria for the report and where in your application they enter that criteria.
For example, if you provide a prompt for the user within your application to get the year for the report, then retrieve the datasource and pass it to crystal, then you should filter the data in the datasource before passing the datasource to crystal. You could also set parameters in crystal to filter the data, but my rule of thumb is to retrieve as little data as necessary to provide the required information.
However, if the user is prompted from within crystal reports for the criteria, then you need to use standard crystal functionality to filter the data. This involves adding record selection formulas using the user entered parameters.

Substitute one table for another at runtime

I have 9 tables with state information in them. They all have the same field names. I have a Crystal Report that is based on one of them. I want the user to be able to select a state and change the Crystal Report to use that table instead of the one it was based on.I mean when user select text in combo box and then click on "OK" then report show (using only one rpt for all the tables of same fields).
How do I do that in VB.Net?
Could you base the Report on a Stored Procedure and pass in a parameter so the Stored Procedure knows which table you want the data from?
I remember trying to get a Crystal Report (v2005) to switch database source from the one it was designed against and that wasn't easy - every table had the connection details in it if I recall correctly! (maybe changing tables is easier though)
It's not easier but if the tables have the same structure you should be able to do it. But you should create a new Document for it and call SetDataSource for your new table. After this you can set the document as ReportSource to your viewer.