Parameter selection for update - reporting-services

I am trying to convert one of our most simple reports to Reporting Services.
The original excel report calls several stored procedures using the results of one to structure the next as it drills down through the data.
I currently have 2 datasets both of which call stored procedures.
The first is called GetGlobalCustomers. This populates a resultset which returns the connection info for each database (we have split our database per customer) and returns the fields ID, Name, Customer and Server.
The second is called GetSchedules which needs the Server and Name provided by GetGlobalCustomers to query the correct database.
However I only want to select the Customer by name, not the individual server/name (remembering which customer is on which server and what their database name is nigh impossible).
So I have a parameter called CustomerName, pushed to the top of the parameters list which presents the user the Customer to select first with the value being the ID. I also have two parameters called DBServer and DBName. How do I set DBServer and DBName to be dependent on the Customer selected? There doesn't appear to be a readily apparent means.
I am guessing that it needs to be part of Available Values and Specify Values but I can't figure out how to say "For this customer ID use this database/Name". I think I could by creating two extra datasets which perform a select by id queries for dbserver/dbname, but if I need to do that each time I want to select by parameter I will have dozens of datasets.

You can do that though your datasource with one caveat: you cannot use shared data sources.
The data source connection string can contain parameters in this case. For example:
="Data Source="+ Parameters!P_Environment.Value + ";Initial Catalog=MyDB;"
You are correct in saying that it needs to be part of available values. One possibility is to make the customer reference the full connection string which would be passed to the datasource. So in this case you would have one parameter which presents the customer name as the parameter text and the connection string as value.

Related

Generate 1 report based on multiple executions of stored procedure (passing different parameters to same procedure)

I have a SSRS report that takes a parameter and executes a stored procedure to generate a report with it.
the parameter is a values from a table that I have user select from a dropdown
let's say 15 options that are passed as parameters to each execution.
AAAA
AAAB
AAAC
...etc
is there any way I can setup the report so it will execute with each parameter and generate a report?
the issue is that now the user has to manually select 1st parameter, generate the report and then export the file result to excel.
what I want to do is a way for the user to select multiple parameters and export just one file containing all of them (the stored procedure can't take more parameters because of the way is coded depends on receiving one parameter only)
so it would have to schedule multiple executions of the stored procedure to create the report and then export this. is this possible? (as a note, the amount of parameters will change frequently so I need to give the option of selecting multiples from a list that is populated from a query to database)
and to clarify, the Stored Procedure needs to take only one parameter, this is not to be solved by sending multiple parameters to operate by using a splitter or similar, as the parameter received by the SP is used in calculations depending of order, (to not go into detail with the SP, just need to take one parameter per execution)
As you already have a report that handles a single option then you can do this easily using sub reports. Don't worry about the length of this answer it actually quite simple.
I would make a copy of the existing report to be safe....
Change the existing report to only accept a single parameter value if if doesn't already. Save this report, this will be your sub-report so let's say it's called mySubReport
Next create a new blank report.
Add a dataset (called say dsParameterList) that will give you the list of options you want the user to choose from (I guess this will be the same as your current report?). For example if it was a list of companies it might look something like SELECT CompanyID, CompanyName FROM myCompanyTable
Next add a parameter called say #options, make sure it is set to be multi-value and set the available values to use a query and point this to dsParameterList. Set the value and label fields as required.
Now create another dataset called dsLoop for example. This dataset will contain a list of selected parameter values. Using the company example from earlier the dataset query might look something like this. SELECT CompanyID, CompanyName FROM myCompanyTable WHERE CompanyID IN (#options)
Next add a table to your report and remove columns so that only 1 remains. Set the dataset property of the table/tablix to dsLoop. This means we will generate 1 row for every selected parameter value.
In the detail row right click in remaining textbox and choose 'Insert Subreport'. Now right-click the subreport placeholder and set the properties to point to the report we saved earlier (mySubReport in this example).
Whilst still in the sub report properties, click the parameters tab and add a new entry, choose the parameter in the left column and set the value in the right column to be the value from dsLoop that you want to pass to the subreport. In our company example this would probably be [CompanyID]
That's it. You run the report and choose from the parameter list, when you click View Report the dsLoop query runs and gives us a list of just those selected Companies, the report body is generated with a row for every row in the dsLoop dataset which in turn runs the subreport with a different parameter passed in each time.
Optionally You can right-click the rowgroup under the main design window and set the 'pagename' property to a value. In the Company example this might be =Fields!CompanyName.Value. When the report is exported to Excel each sheet in the workbook will be named with the name of Company

Inserting data from one table to another using a macro

I have an MS Access database we're going to use at our swimming pool to scan family passes and log usage.
Currently I have three tables, one for the Family Name and Contact Info (tblFamilyPass), another for First Names, Photos, and a unique barcode (tblPassHolders), and a third which logs usage (tblCheckIn).
I have one query that selects the Surname, Phone# and Address from tblFamilyPass that I use to create a relationship between tblPassHolders and tblFamilyPass and associate individuals with their respective Family Pass, and I'm using a form that uses a macro to scan barcodes and filter through tblPassHolders to show the record that corresponds to the barcode.
I have another query that grabs the First name and Family name from tblPassHolders that I'm using in tblCheckIn, which only has two fields: The First/Last name of the individual, and the time they check in.
Now what I'm trying to do, is modify my macro so that each time I scan a barcode, it adds a new record to tblCheckIn.
I'm pretty new to Access, so I'm still doing everything with the macro builder. So far I've only managed to get the table open and select a new record. But my attempts at using SetValue:
Returns the error:
The object does not contain the automation object 'tblCheckIn'
Inserting the time should be the easy part, my efforts to insert the name of the individual have been even less successful.
How do you insert data into one table while browsing data from another? Will I be able to insert two fields into tblCheckIn from a tblPassHolders form using macros?
Using the Macro Builder didn't work out, the solution that worked was the following bit of code using the code builder rather than the macro builder:
DoCmd.OpenForm "CheckIn"
Forms!CheckIn![PASSHOLDER] = Me![BARCODE]
Forms!CheckIn![CHECKINTIME] = Now()
DoCmd.GoToRecord , , acNewRec
There is a point where you have to move past relying on the macro builder.

MS Access: Passing Parameter to Subreport w/o SQL

I'm trying to find a way to pass a parameter from a report to a subreport without resorting to any SQL code or macros (my officemates are non-technical, but still have to use the Access database to run reports, occasionally making tweaks to them.)
I'm working in Microsoft Access 2013. I have a table that contains a list of investments as well as which state those investments are based in. I have a query that pulls data on Investments based on a user-entered State parameter. I then run two reports: one that simply lists the investments grouped on different categories, then a second report that summarizes the investment categories into a table. I've put the summary report at the top of the detailed report as a subreport, but I want to pass the State parameter through from the main report to the subreport so the user doesn't have to enter it twice. Is that possible without resorting to writing any SQL code or macros?
Thanks!
I think I understand what you're trying to do, but please add details if my answer doesn't make sense.
You can pass user entered information by referencing by
[DatabaseObjectType]![ObjectName]![FieldName].
If the user is entering the State value from a Form, you'd reference:
[Forms]![FormName]![State]
where FormName is the name of your form, and State is actually the name of the Form control containing the State value.
If the user is entering the State value in a prompt from a query, you'd reference:
[Queries]![Query1]![State]
where Query1 is the name of your initial query that gets the state info from the user, and 'State' is the name of that field.
You put these references in to your secondary query or report:
for example, in a second query, you can set the State field Criteria (in query design view) to be = [Queries]![Query1]![State]
so the second query will pull the State value from the first query
on a report, similar idea - you can set the Control Source of the State control (in Properties) to be = [Queries]![Query1]![State]

SSRS 2005 Return the parameters that do not return a matching record

I am using SSRS 2005. I have a report that has a single parameter "#Serial". Our support technicians enter computer serial numbers into the parameter field and generate a report returning the matching records from the database table. The count of serial numbers is not hard set and ranges from 1 to 100++.
My ultimate goal is to list the serial numbers that do not return a matching record.
In SSRS I have tried using the =JOIN(Parameters!Serial.Value,",") to list all of the parameter values (serial numbers) into a text field. This works fine to list ALL of the parameters passed but I do not know the correct expression to convert the list so it only contains only the un-matched serial numbers.
It was suggested that I use a Left Join in the SQL query, however, I don't know how to get the parameters entered by the technician into a temp table in SQL so that I can Join the two tables.
Any help on either method is appreciated, and alternatives to these two methods are welcome.
wouldn't you use the CountDistinct control for the parameter values

How to pass parameters to report model in Reporting Services

I'm developing report in RS that show top N customers based on some criteria. It also allows to select number of customers and period of time.
Is it possible to do it by using report model? Thing that it seems to be difficult is how to pass parameters determined by user.
Another thing that in my oppinion is very disappointing is that i cannot use SQL query as dataset query, because it uses odd and elaborate XML. Although report model items seem to map its fields to query or table fields.
I m concerning using report models because i need to provide uniform data model (the same tables and fields) for more or less different database schemas.
It would be very nice if somebody would explain what can be done with report models and what can not.
Maybe what you're looking for is to use the result of a Stored Procedure as the data source for your report. You would need to define parameters at a Dataset level to pass to the SP
You can create report model based paramaterized filters through the query designer by adding a filter, drag the field you want to filter on into the filter area, then right click on it and select "Prompt". This will automatically create a report parameter which you can then edit via the parameter properties dialog to set the data type, allow multiple values, etc.