I've started using SSRS for 6 month and trying to setup a data driven report where the parameter in the report may contain multiple values (customer numbers).
Ive tried to follow the guideline from microsoft:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3b0f1620-a7ac-4edd-a577-4beef4bddb14/forum-faq-how-to-configure-a-data-driven-subscription-which-get-multivalue-parameters-from-one?forum=sqlreportingservices#3b0f1620-a7ac-4edd-a577-4beef4bddb14
The parameter in the report is setup following the guideline:
uncheck “Allow multiple values” option for the parameter
check "none" on available values
check "none" on default values
The dataset properties for the parameter are setup by adding a filter:
CustomerKey in split(Parameters!Customer.Value, ",")
The report is working fine when there is only one customer in the subscription table but report is empty when the number of customer are more than one.
The data set of the report is not changed. The query of the data subscription is retrieving the data from the SQL table where I have stored the emails and customer number are related. The data tables looks like this:
The tabel is formatted in this way:
The query in the subscription using the table looks like this:
SELECT *
FROM [Table_Archive].[dbo].[ReportSubscription]
where ReportName='CustomerOrder' and Schedule='Every day'
The data retreived to be used in the report is defined by the following query:
select
CustomerLabel AS CustomerLabel
, CustomerKey AS CustomerKey
, SalesItemKey AS SalesItemKey
, SalesItemName AS SalesItemName
, SalesOrderDetailNumberKey
From factview.SalesOrder
where CustomerKey in (#Customer)
I've tried multiple solution on how to specify the customer number in the table (',';"," etc) but without success. I'm quite uncertain if the approach that i'm trying will ever work and i'm having difficulties in finding any good suggestions, hence this post.
Related
This seems to be a common issue, but I could find no solution which worked.
I have an SSRS report which shows employee Vacation balances.
I want to make a linked report which will only display information for the current user.
The built in field User!UserID, returns the Login of the User, however that Login is generally not used in our DW, so I cannot filter off of it alone.
We have a stored procedure which will convert that login to the matching UserID, which I can then filter the report on.
My issue there is that although I have a secondary dataset which returns the current users EmployeeID, that dataset cannot be used in the filter of my primary data set, nor in any parameters.
Because of the need to identify current user, I do not know of a way to do this within SSMS, but am stuck trying to make it work in SSRS
To clarify the linked report idea, I was planning to have a Boolean where true/false indicated whether to display data for the current user or just return all. The linked report was an effort to not replicate the RDL with this minor change
Any help will be greatly appreciated, this is the sort of issue I am sure I will come across again in the future
I ended up solving this thanks to the mental jumpstart if got from TPhe..
What was needed:
In my TSQL Procedure I created two new variables. One, a Boolean which toggles whether to filter on the person or not. This Boolean is flipped between the SuperUser and Individual report versions. And the second was an EmpID filter (previously we only had a free-text name filter)
If the Boolean is set to view only individual then the report filters to only Current user, which I acquire through a dataset generated by the SP which I mention in the original question.
The key is the Boolean parameter. I titled it viewALL; Defaulted to True for superusers.
I then created the linked report, and altered parameters so that viewAll was set to False, meaning show only the current user information.
I had to add these parameters to the SSRS so that I could Manage the report on the ReportServer and flip the Boolean, and of course they were needed in the SQL for use in my where:
Where ((viewALL = 'False' AND EmployeeID = #CurrentEmployeeID) OR (viewALL = 'True' AND EmployeeName like '%+#EmployeeName+%'))
I have a bear of a problem here. The user wants a report that shows the earnings, deductions and liabilities (EDL) code of each employee or null/blank if an EDL code doesn't apply to that employee. I needed one row for each employee name and columns for each possible EDL code combination. I got that answer fixed from my previous question here:
Struggling with a dynamic pivot on multiple columns with one being concatenated
I ran into a problem where there are a potential 270 column headings (EDL code combination with "subj", "elig" or "amt" appended) but not every employee will have a value for every column and security settings lock me out of seeing 1 of the 3 payroll groups. This made my report very limited in that when I ran it I could only show on the Crystal Report the data for what columns I had at the time I created the Crystal Report. Well, the user who requested this report has access to payroll group 1 and if even one of those employees had an EDL code that I didn't have in my data when I created the Crystal Reports file then the report wasn't useful to the user. We figured a way for her to get the info she needed by her logging into SQL Server and executing the stored procedure and she did what she needed to do with the data.
Fast forwarding to today I have to create this as a report in SSRS or give detailed instructions on how she can do this in the future if need be since my contract is coming to an end. I'm not familiar with SSRS but I thought maybe that would meet her needs over Crystal Reports. However, I'm running into the same problem. When I add the stored procedure as a dataset (adding it in as text to execute, not clicking the stored procedure radio button) I only see the EDL codes from that particular query not all potential combinations. I need a way to maybe dynamically add columns to the SSRS report, does such a thing exist?
I'm creating a report which is scoped to individual record level for Service Cases in Dynamics CRM 2011.
This report has 4 datasets; 1. Filter, 2. TicketDetails, 3. Materials and, 4. Labour.
The Filter dataset is there to grab the IncidentId of the current service case being viewed in CRM.
SELECT IncidentId FROM FilteredIncident AS CRMAF_FilteredIncident
I have a parameter called incidentfilter, it's source is the Filter dataset. CRM seems to be ignoring the CRMAF_ prefix and just returning all service cases.
Datasets 2 and 4 are both have a where clause to filter on the incidentfilter parameter value. Dataset 3, queries GP, for that I pass in the TicketNumber field from the service case.
My report seems to be running, it's just that it retrieves every service case from CRM.
I've had similar problem with CRM ignoring the CRMAF_Prefix. You can try this:
Just to make sure, do you have more than one table you are trying to apply the CRMAF_prefix on? If you have, make sure you limit the number of tables to just one.
You could try to add the CRMAF_prefix to the fields as well:
SELECT CRMAF_FilteredIncident.IncidentId FROM FilteredIncident AS CRMAF_FilteredIncident
I am modifying an existing report which is setup to let you view statistics per sales rep. You do this by changing the parameter sales rep in the report view.
I need to modify the report so that it can display a page for each sales rep. This will then be exported to Excel with each sales rep statistics being displayed in a separate tab.
I have researched this and found people talking about iterating over a report but I don't think that what they are referring too is what I am asking:
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/27ffabcc-6286-4fed-a8bf-0e5d78560be3
http://jameskovacs.com/2005/08/04/digging-deep-into-reporting-services/
You can accomplish this several ways, so here is 1 suggestion
Create a new tablix report whose query returns a (unique) set of all sales reps
group by sales rep
there is no detail row, but in the group footer/header add a subreport
the subreport will be the report you already are using and it's parameter will be the sales_rep value from your main report query
set page breaks for the group
The main way I can think of doing it is to pass the parameters into the stored procedure, and in there have logic to UNION together all the possible results you want with a field for grouping the sections.
For example if they had a parameter for "Report Sections" and had selected "1, 2, 3", then you pass the parameter to the stored procedure; inside it uses a SplitString routine to convert the commas into a table format, and then constructing another temp table to hold the results. Everything is accumulated into there with a SectionNumber field (1, 2, 3, etc), and then the whole lot gets returned. Your group groups on that, with page break set, and that's it.
I have created a complex report in Microsoft Business Intelligence.
The report has its own (fairly complex) WHERE clause. Is it possible for the user to set the CreatedOn date as part of the criteria?
UPDATE
I was looking at this again. On a basic report (one table) if i import the report over one created with the report wizard, this give you the filter options and works.
On the more complex report that uses the union statement to pull data out of two tables the filter options are available however they have no effect, this is after removing the where clause.
END UPDATE
Thanks
Luke
I have been doing some research into this topic, and it appears that if you alias the fields and prefix them with CRMAF_ this allows you to add filtering. I'm going to look at this over the next few days and see how it works. However it has been noted that several people have been unable to get this to work correctly.
Please note you need to prefix both the table and fields.
You then can set the filter.