SSRS_TEAM

The shared datasets used in reports
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
robinwilson16
Site Admin
Posts: 185
Joined: Sun Oct 16, 2016 6:46 pm
Forename: Robin
Surname: Wilson
College Name: FEA
Position: MIS Consultant
LinkedIn Profile: https://www.linkedin.com/in/robinwilson16
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

SSRS_TEAM

Post by robinwilson16 » Mon Feb 20, 2017 6:00 pm

Lists teams:

Code: Select all

CREATE FUNCTION [dbo].[SSRS_TEAM] (
	@Session VARCHAR(7),
	@Fac VARCHAR(4)
)
RETURNS TABLE
AS
RETURN

--DECLARE @Session VARCHAR(7) = '2015-16'
--DECLARE @Fac VARCHAR(4) = 'CNEB'
SELECT DISTINCT
	Code = LEFT ( TEAM.s_reference, CHARINDEX ( '-', TEAM.s_reference ) - 1 ),
	Description = FAC.d_reference + ' - ' + LEFT ( TEAM.s_reference, CHARINDEX ( '-', TEAM.s_reference ) - 1 ) + ' - ' + TT.TeamName
FROM ulive.dbo.capd_section TEAM
INNER JOIN ulive.dbo.capd_department FAC
	ON FAC.d_id = TEAM.s_department
INNER JOIN (
	SELECT DISTINCT
		TeamID = PRG.m_modulesection
	FROM ulive.dbo.capd_module PRG
	INNER JOIN ulive.dbo.capd_department FAC
		ON FAC.d_id = PRG.m_moduledept
	WHERE
		PRG.m_start <= LEFT ( @Session, 2 ) + RIGHT ( @Session, 2 ) + '-07-31'
		AND PRG.m_end >= LEFT ( @Session, 4 ) + '-08-01'​​
		AND PRG.m_type = 'P'
		AND PRG.m_status IN ( 'R', 'P' )
		AND FAC.d_reference = COALESCE ( @Fac, FAC.d_reference )
) CRS ON CRS.TeamID = TEAM.s_id
LEFT JOIN GC.dbo.TeamTitles TT
	ON TT.TeamCode = LEFT ( TEAM.s_reference, CHARINDEX ( '-', TEAM.s_reference ) - 1 )
WHERE
	COALESCE ( FAC.d_start, LEFT ( @Session, 2 ) + RIGHT ( @Session, 2 ) + '-07-31' ) <= LEFT ( @Session, 2 ) + RIGHT ( @Session, 2 ) + '-07-31'
	AND COALESCE ( FAC.d_end, LEFT ( @Session, 4 ) + '-08-01'​​ ) >= LEFT ( @Session, 4 ) + '-08-01'​​
	AND COALESCE ( TEAM.s_start, LEFT ( @Session, 2 ) + RIGHT ( @Session, 2 ) + '-07-31' ) <= LEFT ( @Session, 2 ) + RIGHT ( @Session, 2 ) + '-07-31'
	AND COALESCE ( TEAM.s_end, LEFT ( @Session, 4 ) + '-08-01'​​ ) >= LEFT ( @Session, 4 ) + '-08-01'​​
UNION ALL
SELECT
	Code = NULL,
	Description = '-- All Teams --'
Attachments
SSRS_TEAM.rsd
(1.29 KiB) Downloaded 200 times

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 1 guest