Reporting Services Service Scenario
Register Instance
When using the SQL Reporting Services, you must register a new instance of the broker. The screen shot below is an example of the parameters needed to connect to SQL Reporting Services.
Fig. 1. Register Instance in Workspace
Report Parameters
If the report has any parameters, these report parameters will show up as Input Parameters for the SmartObject. The example below shows the SQL Server Reporting Services (SSRS) report parameters for the Report Definition Language (RDL).
Fig. 2. Report Parameters
Once the report has been published to SSRS, you should see any additional parameters used such as the example below.
Fig. 3. Report Parameters
Creating SmartObject
Once you have registered an instance of the SQL Reporting Services broker and have published a report you want to use, you can then create a SmartObject to run this new report. You can create a SmartObject manually via the SmartObject design canvas in Visual Studio, or you can generate the SmartObject automatically by using the SmartObject Service Tester. The Service Tester is located in C:\Program Files\K2 blackpearl\ServiceBroker. The example below shows the creation of a new SmartObject for the
Training_Request_Report. Notice that when the SQL Reporting Services is expanded, you should see all report directories for SSRS.
Fig. 4. SmartObject Services
The following screen shows methods that will be created, as well as any input parameters for the Report. If no input parameters are specified in the Report, then none will be listed.
Fig. 5. Methods and Parameters
Once the SmartObject is deployed, you should see the 2 methods created.
Methods
Once the SmartObject has been deployed, you can now run one of the 2 methods available. There are 2 methods for this Service Broker.
- GetPDF – Returns a PDF version of the rendered report
- GetCSV – Returns a CSV of the report when columns are used
Fig. 6. Methods
Below is an example of the GetPDF method:
Fig. 7. GetPDF Method
Each of the Report Methods has a single property called ReportFile. The ReportFile property has the following structure:
- FileName – String of the File Name used
- Content – Binary of file
Fig. 8. ReportFile Property
This ReportFile property can be used by other K2 events such as Mail attachments, SharePoint document events, etc. When using the SharePoint document event, select
Upload Documents,
From Content Field as shown below, then click next.
Fig. 9. SharePoint Event
The
K2 Field value will be the SmartObject representing the report and selecting
ReportFile, Content return from one of the Get methods as shown below.
Fig. 10. Content property
Fig. 11. Document Upload Source screen
The following step shows the SharePoint site and Document Library to use. By default, the File Name property will pre-fill the file name of the Report as shown below. You can change the file name if so desired.
Fig. 12. Upload Document Destination screen