How can I hide subreports if they contain no data? - asp.net

I have a report which has 3 subreports. In the case of no data I want to hide the report. It's giving me this error:
Error: Subreport could not be shown
How can I hide the subreports?

You are going to have to create some mechanism of knowing whether or not a subreport will successfully be shown on the main report because you aren't going to be able to "return" anything back to the main report from the subreport.
Could you create a small dataset on your main report that would query to check if data will exists for the subreport? and then you could use an expression on the subreport element (or container such as tablix or rectangle) to hide it based upon the results of the query on the main report.
Let me know if I need to clarify.

if we directly create a dataset in the main report itself then there is no question of using another report as a subreport we can directly use the fields from the data set created in the main report and assigning parameters to main dataset values. i think that will not server purpose.

Related

Text truncated in Azure Monitor Workbook Table Columns

Im trying to write queries on Azure Workbook so that I can run queries on our logs, which would allow me to drill down and view exactly what the exception message is. While doing so, when I execute a KQL query, on the workbooks, the column values are truncated as shown in picture. I want to be able to see the full error stack in order to troubleshoot the issue. Now I can get the operation_Id from here and then run it in Log Analytics to view full details, but I would like to view everything I need on this single page within Azure WorkBook. Clicking on the column doesn't expand it.
You cannot expand a particular column when you execute a kql query on the workbooks.
If you change the visualization to Text you will be able to see the complete stack error message as show in the below image
There are many ways to do something like this in workbooks, but the grid we use doesn't have the ability to expand a single cell like the logs view does.
As another answer states, you could use the "text" visualization to visualize just one cell (0,0) as a text block, but that only works for once cell queries.
or, in the grid settings you can set the column renderer to be a link for those columns, and have that link open the "cell details" view. that will open up a side pane that shows all the content of the cell in a popup view
or you could pick the "generic details" option which will open a side popup showing the values of all the columns in that row)
or, you can go into advanced settings, and enable the option to export parameters when a row is selected. you can then set it to export specific columns as specific named parameters, and use those parameters downstream to see values in something like a markdown text item in the workbook, or in a subsequent query.
there are examples of things like that documented here: https://github.com/microsoft/Application-Insights-Workbooks/blob/master/Documentation/Interactivity.md

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.

Grouping data in an RDLC

I'm sorry if this seems silly, but I'm new to using Report Definition Language (RDLC) files and I'm looking for advice on the best "plan of attack" for a report I must create.
THE REPORT
The report (itself) must display a table of data above a related set of calculations for each a grouping (of data). I'm hoping to keep one group per page...but that may not be possible as each table may become quite long (but that is another question for another day).
...There can be 1 to N GROUPS
Example
(GROUP 1)
TABLE
FORM CALCULATIONS
PAGE BREAK
(GROUP 2)
TABLE
FORM CALCULATIONS
...and so on.
IS THIS THE BEST WAY TO DO THIS?
Place each group into a SUBREPORT. The sub report would then contain the table & form calculations.
...is this right or is there a better way to do this?
THE ACTUAL ANSWER IS
The outer RDLC contains a LIST control which contained the following controls:
TABLE (containing items related to the collection as a whole)
SUBREPORT
The SUBREPORT points to an RDLC which contained the following controls:
TABLE (containing row items)
(1) Use the LIST's "grouping" property to group your 1-to-N collections. The "grouping" property is found by choosing the LIST control then choosing Visual Studio's menu options as such: VIEW > PROPERTIES WINDOW.
(2) Next, set the LIST's data source.
This is found using by choosing the REPORT and then choosing Visual Studio's menu options as such: REPORT > DATA SOURCES. Drag any field onto the control and the data source will automatically set itself up.
NOTE:
If you cannot "see" any data sources in Visual Studio's data sources window it is "probably" because service references in your project are causing issues...temporarily exclude them from your project and choose RESFRESH icon within Visual Studio's data sources window (they should then appear). Sadly, you must do this EVERY TIME your data source changes.
Once you have the LIST iterating properly you can add-in the SUBREPORT and any other controls.
...I now OFFICIALLY hate RDLC's.
personally if i had to do this report i will do it with two different tables. In one rdlc you can put two datatables one will display GROUP 1 Data the second one GROUP 2 Data. The Table has option Page break at end of datatable which can give the PAGE BREAK Between the two datatables.
Best Regards,
Iordan

Resources