Passing parameters between reports in SSRS 2005 - reporting-services

I'm relatively new to SSRS 2005. I've built simple reports, and spreadsheets but I'm just beginning to delve into the world of fun that is SSRS/RDL. I'm trying to pass one (custom/non-query) parameter from one report (*.rdl) to another. While logically I would like to add a global variable, there doesn't seem to be any straightforward method/technique for doing what I want. It seems each page/report has its own parameters and reports aren't allowed to share each other's info.
I'm trying to simply hide objects/items based on an option that the user selects. Should a user select option A or B, I want to simply hide certain objects on multiple reports (within the same project) based on their selection. I simply check for the parameter value within an expression for the visibility property in any given object. Nothing complicated really. I've tested it out and on just one report by itself, it works. But try to get one report to read that value on another report, and there's no clear path in doing so.
Now as I've grown accustomed to SSRS, I believe there's the "normal" programmer's way and then there's the "SSRS" way. Both are mutually exclusive. So either I'm trying to do something that will never be allowed, it's a "built-by-design" feature and/or I'm going about it the wrong way.
Ideas? Suggestions? Maybe I'm going about this the wrong way.

Ok, so there's a only a few ways to pass parameters from one page to the next. I (eventually) discovered that I was simply trying to pass a boolean from one to the next. The data was not from the database, it was something manual ('true/false'). At first I thought I needed something akin to a global variable which there are a few built-in globals in SSRS. But as I found out, you can't add anything to that collection.
So on this one report I have an image pointing to the 'Next' page of the report. Within that object/image, you can set navigation parameters on that object/image. Makes sense so far.
On the following page, your report parameters must match the position in which the variable was listed from the following page. I guess SSRS passes a non-key based arrays from one report to the next so index/position is vital for getting the parameters right. Hence the arrows allowing you to adjust the parameter order. That was what tipped me off, but I thought it was SSRS was more adept then that in the sense that parameters being passed had to just match in name, not position.
(IMHO) as I see things, SSRS has/tries/must remain fairly static. There's no real sense of events, OO, etc. and yet SSRS seems to stitch elements from VB, VBA (expressions), SQL/T-SQL altogether and spew forth a usable product. I guess that's my newb perspective. I'm sure it will change with time.

Using subreports might allow you the functionality you need. Otherwise, the only other way I know of to "pass" parameters from one report to the next is using the query string.

Related

SSRS Hidden parameter results in "Parameter X is missing a value"

First I would like to apologise for any mistake and misuse of the english language as it is not my natural language.
I built a few reports using SSRS. Each one are feeded through different stored procedures.
Each stored procedures has two parameters: id and date. When I display the report the parameter I only want to be visible the date that will be supplied by the user. The id should be hidden and with the default value of 1. So, I turned the parameter id to hidden and set up a default value with the value 1. Im setting the default value on a report's definition level instead on the datasets used to feed the reports. PLease see below the steps I have done:
enter image description here
enter image description here
I've been through some websites(stackoverflow included) and I've seen similar issues. I followed the suggested tips but still no success.
Any help on this will be very appreciated.
Thanks
P.S. Im using VS2015 to design the reports and SQl Server 2014.
Without knowing more, my first instinct suggests that you have your parameters ordered incorrectly. If you have a parameter, P2, with a default value that is processed after a parameter without a default value, P1, and both parameters are hidden, then the report will fail citing that P1 is missing a value.
See my screenshot below as an example. You need to make sure that the parameters are loaded in the order, vertically, that they should be processed, especially if one parameter is dependent on another. Take a look at the ordering and leave a comment if you need further information.
Revised based on Response in Commments
Try opening the report manager via the Report Server web interface (http://[serverName]/[instanceName - reports is default]/Pages/Folder.aspx?ItemPath=/[directoryOfReport]). Click on the dropdown list beside the report name and choose manage. Check out the parameters tab and make sure the default is set properly. Sometimes, if you've messed with parameter properties numerous times in BIDS or report builder, the settings won't translate onto the server itself. Let me know if that fixes it.

Building a rdl report for CRM

I'm creating my first report for CRM 2011 using SQL Server Business Intelligence Development Studio and i've managed to do a decent amount but as I move into the more complex parts i'm becoming stuck, and I was wondering if someone would be able to help me with a few questions I have:
I'm using fetchXml to get the data from CRM for some accounts that the report is for, I need to include some data from a child entity but can't include them in the same way that I can for a parent entity to accounts. So for this I'm assuming I need to use a separate fetch query, but how do I pass the ID of the account the report is looking at into the second fetch query as a parameter?
Once I've got the names of all the child items with the fetchXml, whats the easiest way to display them all in a numbered list?
EDIT: For 1 and 2 I found that I can use a subreport with the child data in it. Using a list item I can show all in a bulleted list and I can pass the parameter through from the main report to the subreport
I'm listing the account's address on the report but since they might or might not have the lines 2 and 3 fields completed i'm unsure of how to display it without either missing off some of the address or leaving big gaps. I've tried creating different text boxes with the different combinations of line 1, 2 and 3 and then make only one visible with the use of expressions but the iif statement always returns false. Is there an easier way to do this?
EDIT: I've found out how to do this using a number of different text boxes containing the different combinations and hiding them using the visibility rule. What was initially confusing though is that the rule is for if the box should be hidden, rather than if it should be shown
When I add a field onto the report it always has a "First()" statement on it. Is this required or will it limit my report in any way?
EDIT: This doesn't seem to have an effect on the report as the record to run it against is always selected beforehand, so the First() statement doesn't restrict any data
If anyone could help me with any of these questions at all then that would be greatly appreciated.
Thanks
I've found the answers to my questions, i've put them in the original post.

Linking SubReports Without LinkChild/LinkMaster

I'm maintaining and occasionally modifying an Access 97 program that's still a crucial department tool for a very large US corporation.
A number of reports use a "totals" subreport that I cannot link using LinkChildFields \ LinkMasterFields. In each case, the main report can be filtered by numerous (or no) criteria via a "Reports Manager" form.
I've coped with this by using a generic function that opens any subreport in design view, and edits the .Filter property. Works 100% OK.
However, this prevents me from distributing the app as an .mde file, as Design view is unavailable in an mde.
I've tried every alternative I can think of:
setting the subform filter during Open event to that of the Parent (error)
using Docmd.ApplyFilter during Open event (does nothing at all in a subform)
Although this 'old' app suits the Department using it perfectly, their IT want to implement a 'big-picture solution', and I really don't want a competitor to have free access to a heck of a lot of complex business rules I've worked so hard on over the years.
Does anyone have any suggestions re the subform filtering, so I can use an mde?
MTIA
Why can't you link to the "totals" subreport using Link Child/Master? It should run off the same record source as the main report and aggregate over the records. In any case, if you can specify a filter criteria, you should be able to specify a domain aggregate criteria (dsum, dcount, dlookup etc) that returns the same values.
Dynamically editing the filter property in design view to make it work is a kludge. There is a reason that it difficult, not because the Access designers wanted to make it hard for you to embed subreports with dynamic criteria, but because it's a bad idea. Don't do it. There is something wrong with your report record source if you can't either join the subreport on record fields, or get rid of the subreport altogether and aggregate within the main report. You probably already know this, but you can aggregate (sum, count, etc) over the detail in a report in the report/page/group header/footer and give totals that way.
For example, if you were writing a report for a printable invoice, you could move everything above the line items into the report header, leave a line item as the report detail, and move everything below the line items into the report footer. Then you could do sum() over the detail fields to generate your subtotal then add tax, shipping etc. Another way to do this would be to use a subreport for the line items then try to calculate the totals externally, not as simple and way more fragile if the subreport changes.
Have you considered rewriting a query on which the subreport is based? The SQL string of a query is easy to change, and you will be able to make an mde using this method.

SSAS/SSRS remove parameter from cube report destroys report

Group,
We built a data cube using SSAS and are now building SSRS reports off of that cube. Not sure if anyone has come across this, but when you build the report using the wizard and include parameters all looks fine. However if you are in the report after the wizard is compete, and you decide you want to remove one of the parameters you created it debunks the report and the only way to get it back is to re-create the whole report.
Any way you can remove or add parameters after the initial build without destroying your report?
Thanks in advance for the help! I love this forumn!
I had the same problem and this is how I solved it:
Go to the data report tab.
Expand the Parameter button, Here you get a list of parameters.
Delete the unwanted ones.
If you look at the hidden datasets created for each parameter, each one has a query which depends on some of the other parameters, in a cascading fashion. Unless you delete the very last parameter, the other parameters won't work.
You can fix this by manually editing the parameter dataset queries can updating them not to use the parameter you want to delete.
The main query also uses the parameters in a nested FROM (... (... (... fashion. You need to update that so that it doesn't constrain itself to that parameter. Then there is a parameters button on top of the query builder which allows you to remove the reference to that parameter in the query.
I think if you remove the parameters from the wizard, it should update all the other parameters and the query to work correctly. This is probably the easiest route. All of your report objects should remain functional.

Grouping by a report item in SSRS 2005 - textbox - any workarounds?

I want to group by a report item, but that's not allowed.
So I tried creating a parameter...not allowed as well.
Tried referencing from footer...failed again.
This is somewhat complicated.
Let me explain:
I have textbox22, it's value is:
=Code.Calc_Factor(Fields!xx.Value, fields!yy.Value...)
This is embedded VB code in the report that's called for each row to calculate a standard factor.
Now to calculate the deviation from the standard factor, I use textbox89, whose value is:
=(Fields!FACTOR.Value - ReportItems!textbox22.Value)/ReportItems!textbox22.Value
Don't get confused between Fields!FACTOR.Value and textbox22.Value, they are different.
Fields!FACTOR.Value is the factor used, textbox22.Value is what it should be (standard factor).
Now I want to create a group which splits deviations into 2 groups, > 1% or not.
So I tried creating a group:
=IIF(ReportItems!textbox89.Value > 1,0,1)
...But then SSRS complains about using report items.
I have run into a similar problem of using report items in the past, but this is a new case!
Any help greatly appreciated.
Have you tried adding a calculated field to your dataset?
Here is how it works:
While you are in the layout view of the report, open "datasets" tool window(in my environment it is on the left).
Right click on the DataSet you are working with and add a field, you can use a calculated field, and build your formula appropriately
Then you should be able to group on this field
-Dan
I'm not 100% that someone won't have some magic solution for this but I have run across similar problems myself in the past. I believe (but could be wrong) the problem Reporting Services is having is that it only renders once and what you're asking it to do is render the data before rendering the grouping which it doesn't do.
The only way I have ever been able to produce the exact results I need is to make the data rendering happen exclusively in the SQL (through the use of table variables usually) and then use Reporting Services merely as a display platform. This will require that your factoring algorithm gets expressed in the T-SQL within the stored procedure you will likely have to write to get the data in shape. This would appear to be the only way to achieve your end result.
This has the bonus feature of separating report design and presentation from data manipulation.
Sorry I couldn't provide a SSRS solution, maybe someone else will know more.