Collect all parameters from all reports in reportserver folder and populate a sql table - asp.net

[Thanks to Filburt and Devjosh. I have restructured the post and included my attempt approach. ]
I have a table on my SQL DB call ReportList which is a list of report. I need to go through that list and interrogate the reportserver, eport by report, to populate a table called ReportParameters. The ReportParameters table has a column for ReportOwnerID which needs to contains the ReportID value of the corresponding (owner) report as listed in the ReportList table.
This is in VB.NET 2005 ASP2.0 and I have ended up with a mess. Please help me with the cleanest approach to doing this.
It needs to work so:- I have a listbox of the reports as per REportList and a GridView that list all the parameters (uniquely - most of the parameters are common to many reports) the idea being that the parameters get set once and the report can be kicked off by selecting them in the ReportList CheckListBox and clicking on Execute.
I would like it that as I click on a particular report in the ListView, the relevant parameters in the Gridview get a green background and those that do not apply are red. The leftmost column in the gridview contains tha Parameter NAME (not editable) and the next column must be editable to populate the value.
DONE SO FAR:
I have tried on clicking the EXECUTE button , to build a parameters string in a testbox and call that with the Javascript OpenReportWin() function when I open the report in a new window. This works fine, but my biggest issue it interrogating the reportserver reports to get back a list of parameters and dooping them into a table. I have triend to use a hidden DataGrid bound to a ds onto the reportParamaters table; I have tried to poulate it using a datalist but I cannot get the hang of these thionsg and its looking messy. Ther must be a simple clean way of gettting the .GetParameters resultset back from the report server and populating the table without having to create a reportviewer object and cycling through the list of reports - it then has to render each report before you can get that list out.
Thanks

I will withdraw this for now. I will submit a solution when I am comfortable that I have reahced a clean solution.
Mac
PLEASE CLOSE!!!

Related

SSRS Sub-Report only using default parameter to create dataset, even though parameter is successfully being passed from the main report

I have been working with SSRS for the last year and a half or so. Everything I know from it has been learned by trial and error and google. So hopefully I get my terminology correct, but forgive me if I say something incorrectly.
I am using Visual Studios 2015, connecting to SQL 2012 server. I'm creating an asp.net/VB web application to display SSRS reports on a local site. All of my reports up to this point have been a single report with no sub-report. If "sup-report data" was desired, I created a drill-through, using an Action, to navigate to a completely separate page. This has been working really well for all my reports, but now I would like to get a little fancier.
I have been trying to create a SSRS report that contains a sub-report. The main report contains summary information about batches of a particular product that has been run (blue and white portion of the table in the picture).
If a user wants to view more specific details about the batch, they can click on the expand/collapse button of the "Process Order" column, and a sub-report below the summary line will appear with more specific information about the batch (sub report is the light grey/dark grey table).
I configured the properties on the main report to pass the ProcessOrder value as a parameter on the sub-report and create a parameter on the sub report to accept this parameter.
You can tell that this parameter is being passed successfully because I have the respective parameter being passed and displayed just above the table (and it matches the number on the main table). As you can see from the picture, I also have the Process Order number displayed on the sub-report table itself, and this number is different than what is being passed to the report. It is showing a "1", which is the default value that I gave to the SQLDataSource control on my aspx page to build the dataset. I've tried not setting a "Default value" but then I get the following error:
“Data retrieval failed for the subreport, 'test_Sub_Report2', located at: [location on hard drive] Please check the log files for more information.”
Has anyone encountered this problem before, or can anyone give me an idea of a direction to go from here? I feel like I’m very close since I’m getting the parameter successfully passed to the sub-report, but the dataset is just not using that parameter to go get the data from SQL, and I’m not sure how to tell it to do so.
I can add more details and post more of the actual code, just let me know what you need and I will do my best to get it to you. I would have included more screenshots, but I don't have enough rep points to do so yet.
You need to go into the DataSet that populates the sub-report, and go to the Parameters tab, and map the ProcessOrder parameter of the dataset to the Variable that you pass the ProcessOrder parameter to from the main report.
I ended up figuring out the answer. I used the answer from #Lazy Coder on this question: SubReport is not working after adding parameter I was adding the parameters to the sub-report incorrectly. I did have them passed to the sub-report through the table on my main report, which was getting the parameters to the sub-report, but the sub-report was not using these values to create the data set. On my test_page.aspx.vb file I had to change my SubReportProcessing Event Handler. I needed to explicitly set the parameters values there. Since the time that I originally posted this question, I added another parameter to my stored procedure as well, subTotalTime, to correctly filter my results.
Public Sub SetSubDataSource(sender As Object, e As SubreportProcessingEventArgs)
Dim report = DirectCast(sender, LocalReport).DataSources(0)
Dim subProcessOrder = e.Parameters("subProcessOrder").Values(0)
Dim subTotalTime = e.Parameters("subTotalTime").Values(0)
SqlDataSource_PPMS_test_Sub_Page.SelectParameters(1).DefaultValue = subProcessOrder
SqlDataSource_PPMS_test_Sub_Page.SelectParameters(2).DefaultValue = subTotalTime
e.DataSources.Add(New ReportDataSource("DataSet2", SqlDataSource_PPMS_test_Sub_Page))
End Sub
SqlDataSource_PPMS_test_Sub_Page is the id of my SqlDataSource object on my aspx page.

DevExpress XtraReport shows empty DetailReport but correct rowcount

I'm using XtraReports 12.2.12 in my lightswitch project.
This projects connects to a sql database as datasource.
I created a report class and added a query as datasource for the report.
Then added a detailreport with the context menu -> "Insert detail report" to a bound list. (Suggested by xtrareports)
This bound report actually contains the data of a n to n mapping table with references to the corresponding tables. In the detailreport I try to display the data of one of these tables but receive only empty fields.
The funny thing is - the rowcount of empty rows (countable because of the labels I inserted into the report) is correct - only the data is missing.
I thought maybe the xtrareports component is not able to load the data from the referenced table but even the data from the detail report main table is not shown.
Maybe someone could give me a hint on how to solve this.
Thx in Advance
Steve
The solution for this problem was to get rid of the unbound datasource in the report and put every subreport in a separate report class and then insert XRSubReport Control in the main report to include the newly created report, pass parameters and handle BeforePrint events correctly.

ASP.Net Report Viewer - Same report multiple times with different parameter values

I'm currently working on an ASP.Net WebForms application that allows a user to select an item from a list, which ultimately results in a SSRS report being shown, using Report Viewer 2010 (in server mode). The report has been coded with a parameter #id to allow the report to display the correct data for the selected item.
The reports dataset can return multiple rows where some of the data is displayed in a summary area at the top (not in the header section) for example a textbox would have the expression =FIRST(Fields!Address.Value, "dsMain"). The data returned is denormalized so Address will always be the same value. Which is why using FIRST() works. And the rest of the data is shown in a Tablix with grouping applied etc.
But now I'm looking to change this so users can select multiple items and therefore effectively show the report multiple times, but shown in the same report viewer control. The main requirement is to batch print the reports, so showing it in one report view control is important to allow for one click printing of everything.
Now because I didn't design the report in the first place and because its fairly complex in its layout and the sql that is executed; the sql is geared towards running for one id and not a list of them. I'm looking for options to not have to rewrite the report or the sql.
Is it possible to give the report viewer the id parameter as a list and let the report viewer execute same report for each id passed? - I know report parameter can accept multiple values but this isn't the same since the report will unintelligently pass the first value to my stored procedure but not repeat the report for the other values. Perhaps there's a setting in the report designer that allows it to repeat if it is passed multiple values?
Can someone suggest something else to get this working? Or is my only option to extend the report and sql to accept multiple id's and effectively redesign the report?
Thanks any suggestions or help with this.
The answer is to use sub-reports.
Create a new report that takes a list of ids as a multi valued parameter.
Use that parameter as the dataset for a list control.
Have a subreport inside the list. Report inside the list is your original report.
You can then pass each element of your dataset(your list of parameters) as parameter to the your sub-report.
SSRS will repeat it as your want.

Trying to populate ASP GridView as it's data source gets populated on the server

Hi I am new to using ASP.NET and GridView and it would be great if someone could kindly help me out here.
My scenario is that on a button click event, my code tries to get data from a webservice in chunks for a long period of time. Now I create a DataTable and populate it as each chunk is retrieved. My question is how do I show in gridview whatever I have retrieved so far before the button click returns ? Say, if I have three chunks being retrieved one after another then as of now the gridview gets populated with all the data from the 3 chunks at once, I want to be able to show the first chunk as it is downloaded, then add the second chunk and finally the third. Not sure how to do this.
I'd be happy if you just give me an overall solution/point me in the asp feature I should be using to get this done. Thanks.
If you are binding using webservice. Then asp:GridView will create unnecessary hassles for you as its designed for simple server side bindings.
Why dont you try DataTables or jqGrid, as they are much better alternatives?
You can Merge the existing DataTable every time you receive a new chunk from the Web service and then bind the updated (Merged) DataTable to the gridview.
Check out this article from MSDN and get a better idea of how you can merge DataTables
DataSet.Merge Method (DataTable)
Also look at this article that may help you in your current problem.
Merging two Datasets into a single Datagrid

What is the best approach for this CRUD search page in ASP.NET

I'm building a heavily CRUD based ASP.NET website and I've got to the phase of the project where I'm trying to build a search webpage that shows the user different subsets of a certain important table based on parameters they enter such as dates and different text fields.
I can't use a fixed SQL statement, because depending on whether they search by date or by something else, the SQL would be different, so instead I have been generating a results list using a table web control that starts out invisible and then is filled and set to visible once the user identifies a search they want to make. I used a table control because its easy to create and modify in the code behind, and I was able to make the needed calls to the database and populate that table as required.
However, the second thing I need with this search page, is the ability to allow the user to select a record from the results and then go edit it using the rest of the CRUD based pages on the site. To do that, I created asp:buttons in the table and gave them all different ids and the same event handler. But since I created the buttons dynamically, it seems the event disappears on callback and my scheme fails, so I'm taking a second look at how to do this.
My current code for the events looks like:
tempcell = new TableCell();
Button tempbutton = new Button();
tempbutton.Text = "Go";
tempbutton.ID = "gobutton" + rowN;
tempbutton.Visible = true;
tempbutton.Click += new EventHandler(tempbutton_Click);
tempcell.Controls.Add(tempbutton);
temprow.Cells.Add(tempcell);
My results table is declared like this:
<asp:Table ID="ResultTable" visible="false" runat="server"
GridLines="Both" CellSpacing="8">
</asp:Table>
I'd like to be able to identify which record the user selected, so I can send that info on to another page. And of course, I still need to be able to generate results for several different search criteria. Currently I have date, template and code based searches that lead to different stored procedures and different parameters based on what the user has entered.
Any suggestions on this? It seems like the data grids and repeaters require SQL statements in advance to work properly, so I'm not sure how to use them, but if I could then the item command approach would work with the buttons.
Your event will hook up successfully if the button is recreated in the page load event.
Otherwise, use a GridView. It is the perfect solution for simple CRUD, and you can control it as much as you need.

Resources