Description: What the goal was to find a way to automate how an end user could subscribe to a SSRS Data Driven Subscription without any intervention from the Business Intelligence Developer. And also enable the end users to have their own selections. And finally if they did not want to receive the report any longer to then delete their subscription.
In Part 1 we will be creating the SharePoint List, and using SQL Server Integration Services to get the data into our table.
· What we will be doing below is to first create a SharePoint List
o NOTE: This is created on SharePoint 2013
§ And for SSIS we will be using SQL Server 2012
· Then we will use SSIS and a new Data Flow Task to get the data out of our SharePoint List and put this into a SQL server table.
· After which we will then transform some of the data and then store it in a Dimension table.
o This dimension table will then be used later in a SSRS Data Driven subscription so that we can email the report out.
Example for documentation:
· We are going to create our List on SharePoint 2013
o Within our List we are going to have the following fields:
§ Subscription Name
§ Date Range
· We will specify custom Date Ranges
§ Product Line
· We will pre-populate the Product Line list
§ Email Address
· All the above information will be coming from the AdventureWorks2012DW SQL Database
You can get a copy of this here: http://msftdbprodsamples.codeplex.com/releases/view/55330
· I used the AdventureWorksDW2012 Data File and AdventureWorks Multidimensional Models SQL Server 2012
1. In your SharePoint 2013 website click on the Site Contents:
2. Then click on add an app
3. Then click on Custom List, this is so that we can create our own Custom List
4. This will bring up the Adding Custom List Window
a. As with our example we created the following Custom List Name:
5. Now click on your Custom List you created to go into your Custom List
6. Now at the ribbon on the top click on List and then List Settings on the right hand side
b. This will then take you to the List Settings
7. As per our Example explained above we are going to be creating the following columns detailed below by doing the following.
8. Under Columns click on Create column:
b. First we created our Subscription Name by clicking on Title and changing it to the following:
ii. Click Ok to create the column
c. Click on Create Column again to create the Date Range.
i. NOTE: We are going to create names for our Date Range which we will convert to actual dates when we insert the data in SSIS in the later steps.
1. The choices we are going to create are the following due our data having actual data from July 2007 to June 2008
a. July 2007
b. July 2007 – December 2007
c. July 2007 – June 2008
4. Click Ok to create
d. Click Create column again for the Product Line.
i. Once again it will be a choice of the following:
iii. Click Ok to Create
e. The final column to be created is the Email Address column as shown below:
ii. Click Ok to Create.
9. So once completed you will see the following:
10. Next we will use SSIS to bring the data down into a SQL Table.
1. Click on this link below and download the following:
3. Once it has been downloaded, you can run the MSI and complete the steps.
a. NOTE: You will have to close down and open up your BIDS (Business Intelligence Development Studio) or SSDT (SQL Server Data Tools) in order to see the SharePoint List data.
1. Create a new SSIS Package and give it an appropriate name.
a. As with our example we named it the following:
2. The next thing that you need to do is to create a connection to your SharePoint Server by doing the following:
a. Right click on the Connection Managers and select New Connection.
b. Scroll down and select the following:
c. Then click Add which will bring up the SharePoint Credential Connection Manager Editor.
d. As with our example we put in the following:
ii. NOTE: Make sure that the SQL Server Agent Job service account has the permissions to SharePoint.
1. Alternatively use a Custom Credential which will require access to the SharePoint List.
2. In our environment we have got a domain account who’s password does not change that we use.
3. Next drag in a Data Flow Task and as with our example we gave it the following name:
4. Now go into your Data Flow Task and configure it with the following:
a. Click in the SSIS Toolbox and under Common you will see your SharePoint List Source
b. Drag this into your Data Flow Task and configure it with the following:
i. Double click to go into the Properties
ii. On the connection Managers Window you have to select your connection Manager:
iii. Then click on the Component Properties and put in the following:
a. This is so that it will look for all the SharePoint Lists
a. This will be the actual Root of your SharePoint location
b. NOTE: It must NOT be the actual URL To your list, if you do this it will not find the List.
3. Then scroll up to the Site List Name and in here you will put your List that you created above.
a. As shown below is our example:
iv. Now click on Column Mappings and if the above settings are correct you should see all the columns as shown below:
c. Then click Ok to complete your SharePoint List Source
5. Next is to create the destination and for this you need to create your destination table first.
6. Below is the scripted out table that we used:
[Subscription Name (LinkTitle)][nvarchar](255)NOTNULL,
[Subscription Name (Title)][nvarchar](255)NOTNULL,
[Subscription Name (LinkTitleNoMenu)][nvarchar](255)NOTNULL,
[App Modified By][nvarchar](255)NOTNULL,
a. NOTE: Some of the columns from the source might be set to nvarchar(4000) but I know that we would not have anything this long so we left them all at 255 to save space.
7. Next we dragged in our OLE DB Destination:
a. NOTE: You would have to have created a Connection to your Destination Database
c. As you can see we configured it with the following:
d. And mapped the columns as required.
i. NOTE: Ensure that all the mappings are correct
8. Once done it should look like the following:
b. As noted above the reason for the warning is due to some columns from the source having nvarchar(4000)
9. Now the final step is to run it and see if it works as expected
a. But before doing this first add an item to the list:
10. Now run your data flow task and you should hopefully see 1 row transferred
Below is the Stored Procedure (SP) so that we can store the details from the SharePoint List and create some additional column.
The destination table will also be used later in the Reporting Services data driven subscription.
1. Below is the SP which you can use to create your SP.
a. NOTE: You will have to first create the destination table, which you can complete within the SP.
/****** Object: StoredProcedure [dbo].[prc_LoadDIM_Mart_TD_SharePoint_ReportSubscription] Script Date: 2014-04-23 07:50:25 AM ******/
— The sample scripts are provided AS IS without warranty of any kind.
— I further disclaims all implied warranties including, without limitation, any implied warranties of
— merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance
— of the sample scripts and documentation remains with you.
— In no event shall I, its authors, or anyone else involved in the creation, production, or delivery of
— the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business
— profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use
— of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the
— possibility of such damages.
— Author: Gilbertq
— Create date: 16 Apr 2014
— Description: Here we are going to Define our Start and End Dates for our selection
— from our SharePoint List
— NOTE: The format of the Start and End Dates are going to be the DateKey
— from our Date Table so that this can be passed to our SSAS
— AdventureWorksDW2012 cube.
— 1. Getting the DateKey for our Selection: 01 July 2007
— 2. Getting the DateKey for our Selection: 31 July 2007
–3. Getting the DateKey for our Selection: December 2007
–4. Getting the DateKey for our Selection: June 2008
— Below is the query to either update an existing Subscription or if new
— then insert into the table
Endas[Product Line For Query]
,[Subscription Name (Title)]
,Casewhen[Date Range]=‘July 2007’Then@Selection_StartJuly2007
when[Date Range]=‘July 2007 – December 2007’Then@Selection_StartJuly2007
when[Date Range]=‘July 2007 – June 2008’Then@Selection_StartJuly2007
,Casewhen[Date Range]=‘July 2007’Then@Selection_EndJuly2007
when[Date Range]=‘July 2007 – December 2007’Then@Selection_December2007
when[Date Range]=‘July 2007 – June 2008’Then@Selection_June2008
and[Dest].[Email Address]=[Source].[Email Address]
and[Dest].[Subscription Name (Title)]=[Source].[Subscription Name (Title)]
,[Dest].[Date Range]=Source.[Date Range]
,[Dest].[Email Address]=Source.[Email Address]
,[Dest].[Subscription Name (Title)]=Source.[Subscription Name (Title)]
,[Dest].[Product Line]=Source.[Product Line]
,[Dest].[Product Line For Query]=Source.[Product Line For Query]
,[Subscription Name (Title)]
,[Product Line For Query]
,Source.[Subscription Name (Title)]
,Source.[Product Line For Query]
c. With the above SP the reason for creating the StartDateKey and EndDateKey variables is due to our choice in the SharePoint list:
ii. And the above correlates to our variables in the SP.
iii. NOTE: The StartDateKey and EndDateKey will be used later in the SQL Server Reporting Services (SSRS) Data Driven subscription, which in turn will pass the information to the SSRS Report Parameters
d. We also had to put in a Case statement for the Product Line For Query so that it would match the underlying values in our SSAS dimension
e. Another thing that we did do is to validate the email address to ensure that there are no bogus email addresses.
2. So this is what the table will look like with the query for the Data Driven Subscription
The next steps will be in the Reporting Services quick wins document where we will explain how we create our report with the require parameters.
After which we then create our Data Driven subscription
And then finally create our Power View Report and pass this link with the filter in our SSRS report.