BrightWork Reporter SQL Server Feed
Introduction
The BrightWork Reporter SQL Server Feed allows you to use the reporting engine of BrightWork Reporter to extract information from BrightWork and/or SharePoint and feed it to a Microsoft SQL Server Reporting Services database.
The purpose of this is to allow work on large volumes of data in an environment that is built for reporting on volume data. This document assumes that you have a database and a table ready to export to.
Schema
If you use Microsoft Visual Studio, or another software package that can validate code, you can download and include the DataFeedManifest.xsd schema file in your project.
To use this file in Microsoft Visual Studio, add the schema file to the current solution and click on the XML menu option at the top of the screen and click Validate XML Data.
Intended Audience
This document is intended for BrightWork administrators with XML experience and with experience in working with SQL Server Databases.
Using the BrightWork Reporter Data Feed
The BrightWork Reporter SQL Server Feed uses ExportReportToDb.exe, a manifest XML file and a .cmd file that can be ran at a specific time by Windows Task Scheduler.
To use the BrightWork Reporter SQL Server Feed you must:
- Create the appropriate folder structure
- Create a manifest XML file.
- Create a command file to run the manifest XML file and the ExportReportToDb.exe.
- Create a scheduled task to run the command file
Create Folder Structure
You should create a folder structure to store the BrightWork Reporter SQL Server Feed files that you will be working with.
Note: Files in these folders will not be impacted by upgrading or reinstalling BrightWork Reporter or BrightWork.
To create the folder structure:
- Login to your server and navigate to
- SharePoint 2007: Drive:\Program Files\BrightWork\12\ExportReportToDb
- SharePoint 2010: Drive:\Program Files(x86)\BrightWork\14\ExportReportToDb
- SharePoint 2013: Drive:\Program Files(x86)\BrightWork\15\ExportReportToDb
- Create the following 3 subfolders:
- \ExportCommandFiles
- \ExportLogs
- \ExportManifests
Create Manifest XML File
The Manifest XML file is where:
- The report to run is defined
- The data to be exported and where it is to be exported to is defined
A sample manifest file is included at Drive:\Program Files\BrightWork\12\ExportReportToDb\sample manifests\ DataFeedManifest.xml.
The Manifest XML file consists of a header, footer and 2 nodes:
- SourceData
- Target Data
Header and Footer
Every manifest XML file must have the below header and footer.
Header
<?xml version="1.0" encoding="utf-8" ?>
<CubeFeedManifest xmlns="http://schemas.brightwork.com/CubeFeedManifest/v2">
Footer
</CubeFeedManifest>
SourceData Node
The SourceData node is where the report that is to be run is defined. There are 2 options:
- WebPart
This is where you specify a specific web part on a specific page. - QueryFile
This is where you point the BrightWork Reporter SQL Server Feed at a Report Definition file.
Note: For performance reasons, we recommend using the QueryFile method as opposed to the WebPart method. Another advantage of this approach is that the web part does not have to have been actually added to a web part page.
WebPart SourceData Node
Nodes and Attributes | Description |
<SourceData type="WebPart"> | This is where you specify a specific web part on a specific page. |
<WebPart pageUrl= | You must specify the URL of the page the BrightWork Reporter web part is installed on. |
webPartId="d13b1737-3ded-464d-8cf8-b7ab0eedcd37" /> | You must specify the web part id - please see Identify the Web Part ID for more information on how to obtain the web part ID. |
</SourceData> | This is the closing tag for the SourceData node. |
QueryFile SourceData Node
Nodes and Attributes | Description |
<SourceData type="QueryFile"> | This is where you point the BrightWork Reporter SQL Server Feed at a Report Definition file. |
<QueryFile fileSourceType=" " | Specify the gallery type that the Report Definition file is stored in. There are 3 options:
|
filePath=" " | Specify the name and location of the Report Definition file that you want to run. The information you supply here is dependent on the fileSourceType attribute. Sample file paths include:
|
scope=" “ | Specify the scope of the report you want to run. There are 3 options:
|
rootHref=" | Here you specify the web BrightWork Reporter is running in. BrightWork Reporter does not actually have to be added to a web; however, so that it can have a context for generating the report you must specify the URL of a web. |
</SourceData> | This is the closing tag for the SourceData node. |
TargetData Node
The Target Data node is for specifying what columns data should be exported from, where the data should be exported to and how it should be exported.
Nodes and Attributes | Description | ||
<TargetData | This is the opening tag for the TargetData node. | ||
connection=" " | Update the connection attribute to specify the SQL Server connection string to be used.
Sample connection strings include:
| ||
tableName="Table Name" | Update the tableName attribute to the name of the table in your SQL database that you want to map to. | ||
clearTable="true"> | Set the clearTable attribute to be true if you want to delete the data stored in the table every time the SQL Server Feed is ran. Note: The default setting is false. | ||
<ColumnMappings> | The ColumnMappings section specifies the mapping between the columns in the BrightWork Reporter Datatable and the Datatable in the SQL server database. Note: Non-field values may also be exported if required. Use the below mappings:
| ||
<Column sourceName= | The sourceName attribute should be set to the SharePoint column name used in the Report Definition file. Please see How to identify the real SharePoint column name. | ||
targetName= | The targetName attribute should be set to the corresponding table column name in the SQL database. | ||
</ColumnMappings> | This is the closing tag for the ColumnMappings section. | ||
</TargetData> | This is the closing tag for the TargetData node. |
Create Command File
The command file is the file you tell the Windows Task Scheduler to run. It tells the BrightWork Reporter SQL Server Feed application (ExportReportToDb.exe) which Manifest XML file(s) to run and where to save the Log file(s).
Note: The examples used in this section presume the folder structure was created as set out in Create Folder Structure.
To create a command file:
- Open a text editor and create a file with the following format:
[relative path to ExportReportToDb.exe] -m [relative path to Manifest XML file] > [relative path to the new Log file ]
For example, if you have created the folder structure as described inCreate Folder Structure, the line would look something like:
..\bin\ExportReportToDb.exe -m ..\ExportManifests\Manifest.xml > ..\ExportLogs\ExportReport.log - Give the file an appropriate name and a .cmd extension (e.g. openwork.cmd), and save it to
- SharePoint 2007: Drive:\Program Files\BrightWork\12\GenerateReport\ExportCommandFiles
- SharePoint 2010: Drive:\Program Files\BrightWork\14\GenerateReport\ExportCommandFiles
- SharePoint 2013: Drive:\Program Files\BrightWork\15\GenerateReport\ExportCommandFiles
Note: ExportReportToDb.exe will be automatically added to the appropriate location. Do not copy this application into the folder as it will fail.
The manifest XML file, the cmd file and the log file can be called anything.
The log file contains details of who ran the process, when it was run and what emails were sent and not sent.
Running Multiple Reports from a Single Command File
You can have run multiple reports using the one command file, for example:
..\bin\ExportReportToDb.exe -m ..\ExportReportToDb\Report1.xml > ..\ReportLogs\ExportReport1.log
..\bin\ExportReportToDb.exe -m ..\ExportReportToDb\Report2.xml > ..\ReportLogs\ExportReport2.log
..\bin\ExportReportToDb.exe -m ..\ExportReportToDb\Report3.xml > ..\ReportLogs\ExportReport3.log
..\bin\ExportReportToDb.exe -m ..\ExportReportToDb\Report4.xml > ..\ReportLogs\ExportReport4.log
Task Scheduler
Use the Windows Task Scheduler on your server to run the command file at the desired time.
To schedule a new task
- Open the Windows Task Scheduler and follow the instructions in the Scheduled Task Wizard to run the CMD file when you want to email
- Windows 2003: Click Start | Control Panel | Scheduled Tasks | Add Scheduled Taskto open the Task Scheduler.
- Windows 2008: Click Start | Programs | Administrative Tools | Task Scheduler and click Create Basic Taskto open the Task Scheduler.
Note: You can also run the command file on demand by double-clicking on it.
For more information on the Windows Task Scheduler please consult the Windows Server help.
Tips
Tip 1 Identify the Web Part ID
To identify the web part ID, follow the steps below:
- Navigate to the page containing the BrightWork Reporter web part.
- Select Email Data on the web part menu.
- Right-click on the page and selectView Source.
- Search for wpGUID.
The numbers and characters after wpGUID= (excluding the " at the end) is the web part ID.
wpGUID=6ee19d6f-4ba8-4799-bda5-dc9c87bee158
Note: If the report includes Query Parameters (e.g. a My Work report), they will be appended to the end of the web part ID and will appear after the &, - this additional text is not part of the web part ID.
For example:
&CurrentUser=21Tip 2 How to identify the real SharePoint column name
If a column is renamed, SharePoint retains the original column name. The original column name is the one that BrightWork Reporter needs. There are a few ways to identify the real column name.
From the Column Setting Page URL
- Click Settings | List Settings.
- Click the Link belonging to the column whose name you want to identify.
- The column name will be appended to the page URL, for example:
http://sitecolection/sites/site/list/_layouts/15/FldEditEx.aspx?List=%7B41B7A352%2D7FD4%2D4D34%2D8DE6%2DF542D45A58AD%7D&Field=AssignedTo
Note: Spaces in column names in SharePoint are returned as _x0020_ (or %5Fx0020%5F in a browser address window). This is why it is good practice not to use spaces in column names when creating them!
From the Column Settings Page
- Click Settings | List Settings.
- Click the Link belonging to the column whose name you want to identify.
- Right-click and select View Source.
- Do a search for ‘Field=’. Whatever is returned is the field name, for example:
Field=AssignedTo
From the Business Data Catalog Columns
Note: The Business Data Catalog is a shared service that stores information about the data in business applications that exist outside Microsoft Office SharePoint Server. You can use the service to display business data on a SharePoint site and thus display the data in BrightWork Reporter.
To find out the underlying SharePoint name of a Business Data Catalog column:
- Open a view where the column is displayed.
- Right-click and select View Source.
- Search for the Displayname of the Business Data Catalog column whose real SharePoint name you want to find out.
The real name will be displayed before the Displayname, as shown in the below image.