I developed a simple print report in FastReport to print some details in table object.
Now I want to let my users to design and adjust their print report so I store report XML in database and load in FastReport Designer to user.
now to bind information in table.
We must add datasource in designer from database only and after that a connection is open and select all records to user and ...
My problem is that I want to use Custom Entity Object as Datasource for report not database table. How can I do that?
So if possible when the user opens report designer he can adjust column remove or add and drag new columns from datasource to report table and when save that report.
I run print by passing list to RegisterData function of report and it is ok.
You can pass list of any objects to the RegisterData method, look at the DataFromBusinessObject example.
Related
I made an rdlc report before and now I increased two columns in database table. These two columns are not showing in report, what should I do?
In the Report Data Window, refresh the Dataset. new fields will be available in the dataset and you may need to add new fields to your report accordingly
This question already has answers here:
Using Object data source in ASP.NET 4 ReportViewer
(5 answers)
Closed 6 years ago.
I want to print a table of values using ReportViewer in local processing mode. The table will have a fixed number of columns, and a variable number of rows. The data will come from a List of my custom class. Now when I create a blank Report in my project, and add a table (tablix) to display the data, it asks me to add a DataSet. But I don't have a DataSet to add as I want to use a List of my custom class in code to populate the data, so I cancel the DataSet wizard. But if I leave off the DataSet it gives me an error "The tablix ‘Tablix1’ is in the report body but the report has no dataset. Data regions are not allowed in reports without datasets." Can I use a List of my custom class as the data for a Report? If so, how?
https://msdn.microsoft.com/en-us/library/ms251784.aspx
Add a report to the project using the Report Wizard
From the Project menu, select Add New Item.
In the Add New Item dialog, select Report Wizard. Type a name for the
report and click Add.
This launches the Report Wizard with the Data Source Configuration
Wizard.
In the Choose a Data Source Type page, select Object and click Next.
In the Select the Data Objects page, expand the class hierarchy under BusinessObject until you see Product in the list. Select Product and click Finish.
You now return to the Report Wizard. Notice that the new data source object is added to your project in Solution Explorer.
In the Dataset Properties page, in the Data source box, verify that global is selected.
In the Available datasets box, verify that Product is selected.
Click Next.
I have to make a report.rdlc where i have to pass a dataset to it
I have DataTable made using C# not SQLDATAADAPTER other wise it can be filled as
adpt.fill(ds);
but i have only custom built DataTable using c# having columns and rows
How to make it datasource of report or make it dataset
Actually Simple... A Dataset is nothing but a collection of "DataTable" instances. You should be able to do via..
var DS = new DataSet();
YourCustomPopulatedDataTable.TableName = "SomeTable";
DS.Tables.Add( YourCustomPopulatedDataTable );
What * have done was created a baseline "ReportManager" class, but after I get the dataset with data back, I Write the XML output but also the XSD something like
DS.WriteXmlSchema( "MyXYZReport.xsd"); // the report will get this in a moment
DS.WriteXml( "MyXYZReport.xml");
Then, modify your project and add the ".xsd" file created so you don't have to fat-finger the schema for the report. So, the first time through, I query the data, generate the XSD/XML and stop before the actual report. Then, modify the project and add the XSD to it.
Now, open your rdlc. On the left-side you should have a panel for "Report Data". If not, click anywhere within your report, but not a specific object. Just enough to give focus you are working with the .RDLC. Then, click on "View" from the menu and the last item should show "Report Data" option. Once that is displayed, it will show how / where data comes from, parameters, images, data sources, data sets, etc.
Click on DataSets, right-click to Add Dataset and pick the .XSD you added to your project. This will display a dialog prompting with a "Name" to refer as in the report, then a data source. The Data Source should list the name such as "MyXYZReport". Under that will be "Available Datasets" and have the name of the tables within your dataset. Notice the one line change I did above to "name" the table before writing the XSD. Whatever that name is ("SomeTable" ), should be listed in the Available Datasets. Select that. Then, from my purpose, I change the "Name" of the dataset (the first field in the dialog) to the same value "SomeTable". This way, I am not guessing at which name is which. They will all refer to this as "SomeTable".
Now, in the report when you start adding controls, the expression dialog will show your "known" datasets (table instances) and associated fields to go.
I want to create a type of Summary report for an account. The report should have a chart of account data from one data source AND a grid of different account data from another data source.
I want to use all of the data from table one where account_ID = X AND I want to use all of the data from table two where account_ID = x.
Crystal Reports will let me add two different datasources, but It wants to link them to create a sub report in a Master / Details kind of way. I need to report on ALL of the data in table one, and all of the data in table two.
I'm a bit confused on how to do that.
Note: When I'm doing this for one report only, I just create a datatable from a view filtered by the account_ID and then set that as the datasource for the report. That way the heavy lifting is done before Crystal Reports gets the data. Again, not sure how to do that for two different datasources.
If the datasets are different enough that a JOIN doesn't make sense, you'll want to use a sub-report. First, create the report as if you were only using one of the data sets. Then, insert a sub-report where you want the second grid to show up (go to Insert --> Subreport); usually putting it in a new section. Build the sub-report using only the second dataset -- it may help to think of it as a full report in itself, as if the main report didn't exist.
Right-click the sub-report "field" in the main report and select Change Subreport Links. Add the account_ID field and you'll automatically get a parameter, Pm-Table.account-ID, and basic select expert in the sub-report itself.
Double-click it, and you'll get a new tab for just the sub-report. In the long run, you'll want most of the sections suppressed, so the output is just the grid.
Once all that is done, running the main report will display both sets of results.
I am new to windows desktop application development.
I want to generate a bill report that is the bill master details should be displayed once and the related items should be displayed in the tabular format.
I have created the data table in dataset. The data table is configured.
Now in the report design I am not able to see this table to drag the field to their proper position.
Please help how to do so.
Thanks in advance.
Adding datasets
First you have to add a Data Source in your Report. You can do this by using the Data Sources window in VS. Click the Add new data source and select what you want (I usually use object). In the Report Data window there is a folder 'Datasets'. If you right-click it you can add a dataset.
Data in a table
To visualize the dataset you can drag a Table from your Toolbox onto the report, select it, then right-click on the upper-left corner and select Tablix Properties. There you can bind a Dataset to the table. Choose which items you want to display in which column by clicking on the column and selecting a value.
Singular data (textbox)
You can set an expression on a textbox that retrieves a specific set of data from a dataset (you can also use this on table columns btw). You can do this by right-clicking the textbox en going to Expression. This will open up an Expression window that contains some sort of expression builder.
The expression I use to retrieve singular data is the following (not sure if this is the best approach but it's the only one I know):
First(Fields!MyField.Value, "MyDatasetName")
Basically I'm assuming there is only one row in my dataset (or that field is the same in all rows) so I'm just retrieving the first value.