This will require Data Admin privileges to setup and Builder for implementation.
iDashboards is able to connect to a Microsoft SQL Server Database by using a MS SQL or open source JDBC driver. A JDBC driver is a software component enabling a Java application to interact with a database. To connect with individual databases, JDBC (Java Database Connectivity API) requires drivers for each database. The JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between client and database. iDashboards implements native protocols and do not require additional software installed on the driver host. In other words, iDashboards provides driver connectivity with JDBC Data Source via the specified driver.
Stored Functions as a Data Source
MS SQL Stored Procedures
iDashboards supports both Microsoft SQL Server Stored Procedures and Microsoft SQL Server Functions in addition to being a data source pulling data directly from the database tables and views by column mapping or by writing custom SQL queries. This document explains a step-by-step instructions on how to to create the Data Source and derive data from a Stored Procedure and a Function of a Microsoft SQL Server. This is based on the AdventureWorks 2008 database.
It is required for a procedure or function to result in at least two output values. One output will be used for an x-axis and one output for a y-axis. More outputs can be configured for multiple y-axes. The return or output data types are the following:
• Integer
• Number
• String
• Date/Datetime
Input arguments are supported but not necessarily required. Note that the procedure argument can be either Input mode or Input/Output mode. If a procedure argument is necessary for the procedure or function to work properly, iDashboards can be forced to supply one. The return or output data types are the following:
• Integer
• Number
• String
Date and Datetime data types are not supported as procedure arguments. In order to use Date data types, the Date needs to be passed into the procedure/function as a string and converted to a Date/Datetime within the procedure/function. Temporary tables are NOT supported. Procedures and Functions should not read or write to a temp table since temp tables are session dependent, and will cause inconsistent result sets.
Stored Functions as a Data Source
Using a MS SQL Function
Below are the steps to register and use a TSQL Function as an iDashboards data source. The Microsoft AdventureWorks database is used here since it is freely available for download. The following function dbo.TotalSales takes in a Product ID as an INPUT argument and results in the Product ID and Total Sales as OUTPUT.
USE [AdventureWorks]
GO
IF OBJECT_ID ('dbo.TotalSales') IS NOT NULL
DROP FUNCTION dbo.TotalSales;
GO
CREATE FUNCTION dbo.TotalSales(@productId int)
RETURNS @Test table ( ProductId int, TotalSales money) AS BEGIN
INSERT @Test SELECT ProductID as ProductId,SUM(OrderQty*UnitPrice) as TotalSales
FROM Sales.SalesOrderDetail WHERE ProductID = @productId GROUP BY ProductID;
RETURN
END
GO
Execute in Enterprise Manager: Select * from dbo.TotalSales()
Stored Functions as a Data Source
Go to either Data Hub or iDashboards Admin and log in with your iDashboards credentials.
- Click Data Sources
- Then click on New
- You will then fill out the highlighted fields, what has worked for us is shown below:
Data Source Name: AdventureWorks
Server Name: YourServerName (if on server can use localhost)
Database Name: YourDatabaseName
Select: Quotation Quote Character, Quote Table and Column Names, Allow Custom Queries
Driver Download: MS SQL Server JDBC Driver
If using the JDTS driver please contact iDashboards Support for assistance
You will may need to switch to the the MS SQL Server driver. - Then Click Save
- Now Edit this Data Source
- Go the the bottom and click Stored Procedures
- A new box will pop up, click the (+) outlined below
- Fill in the following, you will need to click (+) for Procedure Arguments and Output Columns
- Once you have clicked the (+) for those fields it will look as below and you can fill them out:
- You MUST put in the Arguments and Output Columns in EXACTLY as they are in MS SQL Server (names, data type, order, all columns regardless if you will be using them or not).
- Procedure Name: TotalSales
- Procedure Type: Function
- When you change Procedure Type, the Return Type will change to Table
- Procedure Schema: Owner
- Procedure Arguments: ProductID
- Output Columns: ProductID, TotalSales
- Procedure Configuration should match the data in the boxes EXACTLYWhen everything is completed as previously stated, it will look exactly as the following:
- When you are finished click Save then you will see the following popup message and click OK
- You will then see the stored procedures listed and will be able to (x) or close out of the box
- You can then Save the Edit a Data Source box
- Now you can create a New Data Set (if using iDashboards, create a new chart in Builder)
- Select Table/View
- Now Create Your Charts!
For More Information:
- Creating a Database URL (Connection String)
- MS SQL Sever Stored Procedures Documentation
- iDashboards Admin Manual 10. Managing Data Sources
- iDashboards Admin Manual 12. Using Stored Procedures
Disclaimer: iDashboards Technical Support Engineers are not proficient in the Management and Integration of every API that exists as new APIs are being created everyday with each company that wants to provide seamless integration with other software. However, we do our best to help you make these connections because we want to assist you in your success. If you do not see an article for a connection you would like to make please contact iDashboards Support and know that it will take a bit of time to figure out what is necessary for this integration.
If the above is unable to resolve the issue, then please contact iDashboards Support for further assistance.
Stored Functions as a Data Source
Comments
0 comments
Please sign in to leave a comment.