C# Populate ReportViewer from arrays (High Level) - c#

I'm going to build a few arrays and want to populate a rdlc report from them, but want to make sure I've got the high level process down before I start coding. I'm populating these arrays from calculations based on foxpro (sigh...) tables.
Do I need to create the report first through the wizard and throw generic columns in there, then adjust as necessary? Or can the code completely do everything? Previously, when I tried to do this through code-only, the Report.Refresh() wouldn't actually launch the report...
So:
Create Report with generic columns and modify as necessary later
Populate arrays
Stuff arrays into report and display?
Remember, I'm looking for a high-level process flow right now, there are tons of code examples on each individual element I'm just not sure I've got the process right.
Thanks in advanced.

After much research and fumbling around, I finally got it to work on my own...so if anyone else stumbles across this, here is what worked for me. I'm certain there are better ways to do this.
Populate Arrays as necessary
Create Data Set with a data table as defined
Populate dataset.datatable with arrays
Create report.rdlc using datatable from step 3
If using WPF, add the WinForms control to your WPF application
Stuff datatable in to datasource (reportdatasource.value = dataset.datatable)
Give reportviewer the embedded resource of your report
Refresh
????
Profit!

Related

need help in generating report in c# wpf

I have a program which analyses some information in runtime and save the analysis results in certain variables. I have 15 of these variables, of which, 13 are string type, 1 integer and 1 bitmap image. I want to let the user to generate a report based on the analysis data. I have been trying to search the forums for help, but couldn't find a proper solution yet.
First of all, I don't want to save these analysed results in a database (SQL etc). All i want to do is just to display the report to the user based on analysis results and let him save or print it.
This is what I did so far based on numerous hints that I get from forums. I added a report.rdlc file and created a template for the report. I also created a dataset.xsd file and added the analysis parameters to the dataset. All the dataset values are added to the report template.
Now this is where I am stuck. I don't have an idea how to proceed from here and generate a report. Right now what my program does is, upon button click, the analysed parameters will be saved in their respective variables that I specified in the main program. What I want to achieve is to use these results and generate a report as in the template. Sorry that I am not able to post images here due to the user restriction.
Any guidance on how to achieve this is much appreciated.
Thank you!
From what I recall, reports support parameters which can be injected via the presentation control.
With little else to go on, I would look here first.

ASP.net reporting methods

This is frustrating me to no end. I need to create a report based off a SQL query to be displayed in a report viewer on an asp page. Seems like it would be simple but I can't seem ti find an example of how to accomplish this. I don't need a stored procedure I need something I can add variables to like stringbuilder. The user will give an input and then the report will populate based off the query that the input was passed too. Simple seems like but anything dealing with a report seems to want the wizard. What can I do to get a report that looks good and I can use a sql query to bind data to? Thank you in advance.
You can use Gridview to display table from a database. A good start can be read here and here.
Please give us some additional info on what you need so that we can able to help more. :)

Select or Deselect Report Columns in Runtime

i want to build a payroll report that user can select or deselect columns as user wanted. for example for each employee user can select check boxes that represent each column in a list like - Nic, Net salary , Nopay day , etc in any combination.i think all columns are returned in the SP and only shows selected columns.Can you please give me some idea how to do it..
Tilan. I'm not aware of a crystal reports presentation app that you can get that will make your job any easier, but I'd not be surprised if you are spoilt for choice. SAP offer report serving software and their material on Dashboard Design and Crystal Server may be worth looking at (SAP Crystal Reports). However, this may be overkill for your purposes.
An alternative approach is to try to define "loose" columns (I don't know the professional term!). I distinctly recall pulling this off some years ago, but don't recall the specifics and no longer have access to the report (previous employer). This article covers the steps. It's ugly and has a range of disadvantages (huge gaps where columns have been suppressed being a big one), but it might solve your problem.
This guy creates generic columns in his report then builds his query on the fly. His form only caters for the one report, but I think you could adapt his solution to suit your needs.
Cross-tabs may be exploited to suit your purposes (I think). I have little experience with these, but it seems a little tweaking might allow dynamic columns.
The better alternative (by far) is to handle this in your presentation. You've tagged WinForms and C#, so I can assume you've created a win app with a report viewer on it. Assuming you define your dataset in the report, your code should be able to handle the creation of columns at runtime (or suppress/enable and reposition) by looking at the report's DataDefinition. I've read that creating columns at runtime is somewhat dependent on your CR/VS version which I can only guess at.
Hope this helps.
If you can narrow the combination of selected columns to a manageable minimum you can create a subreport for each combination and suppress all subreports except the right one.

Create a report with its respective chart from a chosen LINQ query in C#

I'm quite busy reading different posts over how to create reports from dynamic queries. I have the next problem and maybe someone here can help me with this:
I have a class where I can create a dataGridView from a dynamic dataTable in a project made with C# from VS 2010. I populate my DataTable with one of 9 different linq queries that I have according to the user requirements, which also are saved in a register in my database. Starting from this point, I need to make a report where I can show of the same way the data selected.
I have found the code from the website got ReportViewer and it works quite good. Only I have a last problem. I need my report to show a chart according to the parameters passed via the DataTable. I saw the examples that they have there for the charts but they work quite restrict with what I need, and the code for the chart generator that is incluided in the Dynamic Table project is quite extense and a bit complex for a beginner like me.
Do you know any other examples that maybe I can find to use to make the code in my project? Many thanks in advance :).
I found another way to do it:
Now I'm using classes as datasources and filling arrays of these classes with the contect of the datatable.
I pass these arrays as my datasources for the project.
I group my data by the number of fields I want to display and then I choose between pre made .rdlc files where I show my data to the user.

DNN How to create a complex module with multiple controls

My goal are to create a module that holds a listview with entries of xml files. The xml files are just serialized arrays of some object. Country{Code,Name,URL} as an example.
When an entry is clicked another control should show all the items in some kind of item control with styling based on the type(The idea are from WPF). I assume its possible to create some kind of style/rules for possible item types, in above case Country. (any ideas/advises on how to achieve this is welcome).
Now in the list of styled items, one should be able to select wanted items, and export this to a new XML file based on a new type SelectedContries{Code,Name,Url, Params}. The user will then need to add in the extra params in the new list and export(serialize).
My question is now, to do such module what would be the proper way. One module with 3 controls. I am new to module development so please explain deeply. Do i create Asxc files within the module as my controls?
Based on my explained goal above, any links to guides that might be good for exactly this would be nice and any general advises are also welcome. Thanks.
if I got you right, that you want to have a grid on your module showing all your country entries read out from a xml file.
The user can edit or add some detail information to those entries and export (serialize) it again into xml.
I would use the implemented Telerik Grid RadGrid (DNN wrapper is called "dnnGrid") to show all xml items in a grid on your module.
Then I would enhance the grid for your special needs adding some new columns or edit the existing (dont know exactly what you want to edit in this grid).
The last step is to serialize the entries again this should be done with a extra button calling the serialize method.
These are rly basic ideas from me. Iam a dnn module developer I think I could help you better if you explain it to me a lil detailed, show me a bit of the xml file and so on.
best regards, noone

Categories