I am trying to make a report. The class that I am working with has several ICollection properties, and passing those values to the report for display is difficult.
I have created a class called FlatClass that has all of the string values that I need to display. In the Controller, I plan to populate an array of type FlatClass and pass it to my Report. From what I have read, I need to create a custom dataset/data source. In Visual Studio 2013, when I click Add DataSet in the Report Data tab, it wants me to choose a table from my database. But ClassFlat does not have a table in the database.
I have added a .xsd file, but I cannot find any instruction on how to tell it the names and types of the Fields I want it to have.
Any help would be greatly appreciated!!!!
I tried to create rdlc report in my web application but I could not add my class as dataset. There was no option for that.
Workaround:
Create a Library project in the same solution.
Add the main project as reference to this new Library project.
Create a rdlc file.
Add dataset; for datasource select New->Object->Choose the class from you project namespace
Do your report and when it is complete, move the file to the main project
Not sure if your problem is similar but hope the information is useful.
I ended up creating an .xsd file and just editing the raw XML to add all the properties of the class I wanted to use as a dataset. This worked when I added it to the report.
Related
I'm new to DevExpress and I created a .repx report using the RibbonReportDesigner. It's working fine in print preview reading from SQLite and loading the perfect design.
I saved the .repx file in project directory and changed its copy to output directory property to 'copy always'.
I have a button that should load this report, but I don't know what to do next and I couldn't find an answer online.
As shown in the attached picture I have a simple structure, Form1 takes several inputs from the user and generate a barcode, the barcode is well designed through RibbonReportDesigner but still I don't know the next step.
Another option that might better suit your needs would be to save the report to your project as a report class. Add a new DevExpress report object to your project and load your existing design from the .repx file.
When you want to print the document from your code, instead of instantiating a new XtraReport object and loading the layout from the .repx file, instantiate the CustomReport.cs class instead. Because your custom class is inherited from the XtraReport class, it will function the same and you can fill in your parameters like normal.
I'm modifying an SSRS report inside a Visual Studio project. The report is based on a view in SQL Server that I've modified. The DataSet properties refuses to pick up the new columns in the view without manually editing the XML .rsd file. Searching through these posts and on other sites going back as much as 10 years, there seems to be a "Refresh Fields" solution on the DataSet properties but my DataSet Properties dialog has no such button. I don't want to delete the data set and lose all the report formatting that is already done. There has to be a way to update the data set with new fields.
Scenario:
I have an RDLC file - TestReport.rdlc
I have a form - Form1.cs
I have a ReportViewer - rptViewer
My datasource for the report will be an XML file or a datatable defined at run time (in button click event). Now when I am in design mode for the report how do I add the DataSource or DataSet to the report so I can "add" the columns/fields into the report?
Right now in the report when I click New -> DataSet I am asked to pick from Database, Service, Object or SharePoint but I want to use an object which exists in memory.
I am using VS2012.
Thanks,
Andrew
In case of XML, you have to create the schema for it and then add it to the report in the design view.
A little example is exaplained in this blog (it's old but still good to understand what you have to do).
If also the XML's schema is dynamic, the only solution I came out is about to create one paramater for each node/attribute of your XML and build one or more .rdlc files for every type of XML
I created a website and a class library project. The website have a reference to a class library.
I added a new Crystal Report item to the website (CrystalReport.rpt), and on the Database Expert screen, in the Database Fields section I need to select fields that are members of classes in the class library (referenced project). Only the website classes appear in the list.
Is there a way to do this?
Thanks.
I've had this problem before, in order to see the DB fields, I had to create the XSD even if I had to populate a dataset and pass it along once in design time (debugging) . Try doing so before adding the rpt file.
I am new to Crystal reports. I need to build a Report but don't have access to Data Source. The reports need to be populated with a .Net Class containing a List of Data. How can i do this. I have been searching on Google most of the day but can only find examples of using a SQL or ADO.NET data source. How can i do this using a Class Object with a List in C#.
Kind Regards.
Mateen
We can use .Net Class as a DataSource For Crystal Report
While Adding Crystal Report it will ask for Ad0.Net or .Net Object.
In that we have to Choose .Net Objects.
it would list all the classes in your project.
in That we can choose the class which we want to use it as a datasource.
Then the properties of the Class will be listed and in that we can choose the necessary fields
Here is the Sample Code:
Dy_Daywisesales_RPT myDataReport = new Dy_Daywisesales_RPT();
// This is to get the individual textobject
(myDataReport.Section2.ReportObjects["txtFromDate"] as TextObject).Text=Daywisesales.From1;
(myDataReport.Section2.ReportObjects["txtToDate"] as TextObject).Text=Daywisesales.To1;
(myDataReport.Section2.ReportObjects["txtStation"] as TextObject).Text=Daywisesales.StationName;
// This is the collection as a datasource
myDataReport.SetDataSource(Daywisesales.lstDayWiseSalesDetails);
crystalReportViewer1.ReportSource = myDataReport;
Reports need a data source. You may be able to serialize the list of data in the .Net class to an XML file, comma delimited file, or some sort of data structure that crystal reports can connect to and then use.
I don't think you can connect directly to a .Net class and "report" on it.