Here's what I'm starting with. I have a report with a subreport in it. What makes this subreport unique is that the XML for the subreport rdlc is generated at runtime and the stream then provided to the report viewer. It was pretty much the only way to lay out the data the way we needed it to be. This report by itself works fine.
Now I'm at a point where I want to combine multiple reports. I created a report with a list. Within the list is a subreport pointing to my original report. But I'm stuck trying to figure out how to apply the dynamic subreport since it is a different stream for each report in the list.
We've already done a lot of work on the original report to get to this point, so I don't really want to rethink my approach.
Here's what I've tried so far:
Call LoadSubreportDefinition for my stream when the SubreportProcessing event gets called for each report in the list. I'm pretty sure this doesn't work because you have to do this before the report rendering begins?
Figure out a way to specify an expression for the Name of the dynamic subreport so that I can call LoadSubreportDefinition using a unique ID. For instance, the Name would be something like ="ImageSubreport" + Parameters!ID.Value and I'd call LoadSubreportDefinition("ImageSubreport1", stream1), LoadSubreportDefinition("ImageSubreport2", stream2). This doesn't appear to be possible in the designer, so I don't think it's possible.
Is there some way maybe to generate each report separately, then merge them?
You just need to call LoadSubReportDefinition immediately after calling LoadReportDefinition.
Lets assume the definition for the main report points to the subreport like this:
<Subreport Name="Subreport1">
<ReportName>MySubReport</ReportName>
...
</Subreport>
and you have stream1 representing the main report RDLC, and stream2 representing the sub-report RDLC.
You need to do something like:
this.ReportViewer1.LocalReport.LoadReportDefinition(stream1);
this.ReportViewer1.LocalReport.LoadSubreportDefinition("MySubReport", stream2);
Related
Hope you're well. I'm currently building out a report, but despite my best efforts so far, I can't get some information to populate within the report. It does not appear to me that salesforce is recognizing the field "Agent Incoming Connecting Time" within the object "AC_Agent_Performance". However, I can pull in some other fields within the same object into the Agent Performance report, so I'm not clear on what is not taking place in the field that I wish to see within the report. Here are some of the things that I've tried:
I have checked the access to the field. The first photo (Photo 1) Shows an example of a working object, the the second one shows an example of one that does not.
The API name seems to work, and is consistent with other fields within the object that work.
I have checked the page layout for the object (even though I don't think this is the issue), and I have mirrored other fields to the best of my knowledge that ARE populating within the report.
I reviewed the CTI flows to see if there was something missing in there on a lark, but there was nothing in there that would lead me to believe that this was the source of the problem.
I have tried setting up a new field in the object (formula), that references the field that I'm trying. to pull in, but that just returns a result of 'zero' for all values.
One thing that I have done that appears to be working, is I have set up a joined report, which uses both "AC Agent Performance" object and "AC Historical Queue Metrics" object in the report. The result that is returning appears to be accurate (please see the picture (picture number 3)). However, I don't think that this is the right way to go about this, and I don't want to do it this way. I want to use the report with one object rather than with two.
I know that permissions are the most likely issue, so I've taken a close look at these. Please let me know if there is something wrong with how I have the permissions configured. The First image depicts the 'Field Level Security'. The second image depicts the'field accessibility'. They are both like this, the whole way down:
Please note one other thing, which is that the last picture depicts a different field within the object displaying in the report.
Does anyone have any ideas on how I can proceed so the field "Agent Incoming Connecting Time" will display within the report?
Please also note, that these are objects that contain data that is populated from AWS' Amazon Connect.
This last photo, shows that the object does not have any information in it within the report.
If the field isn't populated there's not much you can do on the reporting side of things. You already tried "joined report". You should check why the integration doesn't populate it, maybe read integration documentation, contact the managed package's support...
The tables are connected with lookup or master-detail, right? In a pinch you could try making formula field on "AC Agent Performance" looking "up" and pulling the value from related AC historical queue metrics. If the relationship is other way around (performance -> down to related list -> metrics) you could try to make-do with a master detail and rollup summary field. I don't know this package, no idea if you can pull it off when you don't have full control over the fields.
If you can't really use the relationships and absolutely need to report on single table - you could capture intermediate results of the report to a helper table and then report on that. It's called "reporting snapshots". Or write some nightly (hourly?) batch that recalculates stuff and writes homemade "rollup" to these fields?
I am working on my first report designed in Visual Studio (2015) SQL Server Data Tools.
My sub-report is only returning one record for each parent event though the sub-report's dataset is returning multiple records.
My Report:
On-the-clock-report in design view
The linking value for the sub-report is the field [EmployeeWorkSessionID]
The Sub-report
Breaks Sub-report in design view
The sub-report's dataset also contains the field [EmployeeWorkSessionID]
Sub-report preview #1
Sub-report for WorkSession 293
Run by itself this sub-report returns 2 records for WorkSession 293, including a Lunch still in progress.
Sub-report preview #2
Sub-report for WorkSession 288
Run by itself this sub-report returns 2 records for WorkSession 288, including a Lunch that is completed.
The (not so) complete report
The full report preview
The preview of the full report shows the first record for each WorkSession,
but none of the others. The EmployeeWorkSessionID's are associated with the correct Employee. The report space is large enough for three lines. The correct records are return by the datasets, they are just not displayed. The open lunch break (containing NULLs) is not the only record being skipped.
Any ideas?
This does not constitute and answer but is too long to fit in a comment...
Basically the design, from what I can see, looks OK. (BTW: Thanks for posting plenty of screenshots of the design and outcome, so many people don't..)
There are a few points and thing to try, more to eliminate them than solve it but give them a go and see what happens.
Make a copy first !
Check if any items have CanGrow = false and set them to true
(True is default)
Remove the rectangle around the report items
You have several text boxes overlapping, just ot be oin the safe side, move these so they don't overlap
Move the sub report so it's below the Breaks: text box
A few more comments just for reference.
The subreport placeholder in your main report can be smaller, it will expand to fit the content
You don;t need the blank space at the bottom of the subreport, the report will expand to fit the contents, any additional white-space, by default, will be appended under the subreport's tablix. In other words, shrink the subreport body as small as you can, this will also help to eliminate issues with pages spanning more than you want further down the line.
See how you go and post the results back here. Once these things are eliminated we can look further.
This issue is caused because SSDT Report Designer caches the data collected the first time you preview the report and does not rerun the dataset queries on subsequent previews!
Obviously some actions must cause it to renew the datasets because my report did change over the course on the days; but it did not change often enough to make it obvious what was happening. The solution below looked like it was working because moving the sub-report caused an update. But after that run the report data remained static while the database changed.
Here is a tool to reset (delete) the cached data.
And the stackoverflow article that saved (what's left of) my sanity.
My report was working the whole time; Visual Studio was being lazy.
If anyone knows of a way to force live data access for all previews I would love to know about it too.
in Sql Server Reporting Services Report
is it possible to define a MDX query within a report, and then re-use it a bunch of times, but each time with different WHERE section.
i.e. the Members and SELECT section would be the same for each row (MTD.Count YTD.Count)
but, i'd want to filter it 10 different ways..
The only way i can think of doing this right now, is adding 10 datasets, each with a different WHERE section, but i'd like to re-use just one DS
ALTERNATIVELY
Another totally acceptable option would be to supply whole MDX queries to the report as parameters of some sort. My challenge is that my MDX queries are generated dynamically (including the # of actual queries), all of that is user driven. So is there a way i could supply n MDX queries to a report, and have it plug that into a matrix? One way i thought of doing this today, is to emit the whole RDL XML dynamically..
You can have the dataset using a few parameters like this:
SELECT
{
StrToSet(#rowAxisMdx)
} ON 0,
{
StrToSet(#columnAxisMdx)
} ON 1
FROM [Cube]
WHERE {
#StrToSet(#slicerAxisMdx)
}
It will be slow since you are using a lot of StrToSet functions, but it should work.
This is most likely my solution:
Subreports
Yep, subreports saved me here.. My actual goal was to repeat the same MDX query with a different WHERE section for each row. Sub reports are design for just that. You can define a matrix and bind it to a dataset. That dataset will determine how many rows of data your matrix will be populated it.
You can embed a subreport in a cell of your matrix, and pass it a parameter (in my case i am passing the whole WHERE filter, but you could make it more granular and only pass a field.
Then in your subreport you can display just one set of information based on a parameter which is passed in from parent report.
here are some more links
SubReports
Designing Reports with Custom MDX Queries
I'm working on a series of reports which need to be shown in two languages so I've created a common header that I planned on embedding into the content of each report. I have two data sets, one that looks up a set of strings in English or French (depending on a parameter passed to the report), and another with numerical data.
The original header worked fine and when I extracted it into a separate report it also runs fine. I am just passing the name of the report to the subreport. When I run the main report, it seems that the values in my string dataset are all null (I've tried all of them) yet if I try data from my numerical dataset, the fields have values and get displayed as the title.
If I also insert a text field with the same expression to display the report title after the subreport, it works fine but the title still does not get passed to the subreport.
I cannot make any sense of why this would be happening, anyone have a clue?
I'm using Report Builder 2.0 and SQL Server 2008.
Thanks!
Alright, so I worked around this issue by simply passing my parameters on down to the subreports and letting them call the stored procs again. Not ideal since I now have to call that one stored proc 3 times but it probably won't be noticed.
I tried several other work arounds and received errors like rsAggregateInCalculatedFieldExpression, so my best guess is that this was caused by attempting to use an aggregate function (First) where it is not allowed but the error was never shown.
I am going to design a report using SSRS 2005. Is it possible to have the selection of dataset done dynamically?
Let's say I am going to have two tables, where the first one is the summary and the second is the detail data. One of my parameters (with values Summary and Detail) will determine which version of the report is to be displayed. Can I have two different datasets, and while clicking the view report button in parameter view dialog (or before) set which dataset which will be used?
You can use the single data set by using switch statement some thing like this:
You can type this in data tab but the results can be seen only in preview tab, but not the data tab like regular queries.
=Switch(Parameters!ToDecide.Value = "Summary",
"Your query for Summary",
Parameters!ToDecide.Value = "Detail",
"Your query for Detail")
Make sure you don't have any excess spaces with in the query(not more than one space where needed)
Both the queries should return the values required by the Table in Layout.
You'll probably have to have 2 pairs of table contained in, say, a rectangle, and hide the unused one (at the container level). Or use subreports.
If you find a way to switch datasets, then you'll have to make sure that all columns are the same as well as making sure that any functions using the DataSet as a scope parameter are changed too... which makes me think it just isn't supported.
You might want to try using a single dataset and having a summary and detail data region (table, list, etc.) in the report, one of which is visible and one of which is not. In this scenario, the dataset is only evaluated once and you are still meet your requirement.
Hope this helps,
Bill
It would be easier to create and maintain if you have two separate tables and hide one or the other depending on the choice made.
I haven't tried this, but I think another possibility would be to use three reports: a container, a summary subreport, and a detail subreport. Switch between the subreports according to the choice.
There is a performance gotcha to the first implementation though. SSRS will try to fill every DataSet in the report when it loads, even ones that are not used in the report's output or by other DataSets or expressions. In other words, just because you're displaying the summary report, doesn't mean that you're not asking the database to fill out your detail data as well.
There is a workaround that can improve the performance a bit, but will still end up with a trip to the server. The hack is to set a flag parameter to determine whether or not the query should actually return any real results or if it should just return the columns you want.
You may try adding condition that depends on a cetain parameter to execute. Then from there, You may use different data set. Assuming that you'll use it on separate hidden tablix.