- Contents
Dashboard Help
Stored Procedure Data Source
The Stored Procedure data source allows you to specify a stored procedure to retrieve data from a database you specify. Only stored procedures that meet one of the following criteria are available:
-
The stored procedure accepts no parameters.
-
The stored procedure accepts the "@UserContextType" and "@UserContextValue" parameters. If the stored procedure meets the criteria, it passes "@UserContextType" one of the following values, depending on whether the logged on user is an Owner, Branch, Department, Team, or Desk. It passes "@UserContextValue" a value corresponding to the type. For example, if the user is a collector, "@UserContectType" = Desk and "@UserContextValue" = the user's desk code.
If there is more than one value associated with a user context type (for example, the user is the manager of more than one branch,) the value passed to the stored procedure includes all the branch codes separated by "|" characters. The following stored procedure demonstrates this concept:
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
CREATE PROCEDURE [dbo.] . [DashboardAllThreeParameters] | ||
@UserContextType VARCHAR(20), | ||
@UserContactValue VARCHAR(8000), | ||
@UserId VARCHAR (80) | ||
AS | ||
BEGIN | ||
SELECT | ||
@UserId AS UserId, | ||
@UserContextType AS ContextType, | ||
string AS ContextValue | ||
FROM [[dbo] . [StringToSet] ( | ||
@UserContextValue | ||
, '|' | ||
) | ||
END |