B2017-230 Added a stored procedure and function to check for the usage of a given applicability.
B2017-230 added references to working draft property page to all applicability usage check results to appear in the Search panel results pane. B2017-230 Added a check for the usage of the applicability that the user wants to remove.
This commit is contained in:
@@ -5286,7 +5286,68 @@ GO
|
||||
IF (@@Error = 0) PRINT 'Function: ve_GetItemDerivedApplicability Succeeded'
|
||||
ELSE PRINT 'Function: ve_GetItemDerivedApplicability Error on Creation'
|
||||
GO
|
||||
-------
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ve_GetItemAppliedApplicability]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
|
||||
DROP FUNCTION [ve_GetItemAppliedApplicability];
|
||||
GO
|
||||
|
||||
/****** Object: UserDefinedFunction [dbo].[ve_GetItemAppliedApplicability] Script Date: 09/17/2018 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
/*
|
||||
select [dbo].[ve_GetItemAppliedApplicability](48)
|
||||
*/
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2018 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE FUNCTION [dbo].[ve_GetItemAppliedApplicability] (@ItemID int) RETURNS varchar(max)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @apple varchar(max)
|
||||
select @apple = dbo.ve_getitemapplicability(@ItemID)
|
||||
if(@apple is null)Set @Apple=''
|
||||
/***
|
||||
begin
|
||||
declare @ParentID int
|
||||
select @ParentID = dbo.ve_getparentitem(@ItemID)
|
||||
if @parentid is not null
|
||||
set @apple = dbo.ve_GetItemDerivedApplicability(@ParentID)
|
||||
else
|
||||
begin
|
||||
select @apple = coalesce(@apple + ',','') + r2.value('@index','varchar(max)') from
|
||||
(select cast(config as xml) xconfig from docversions
|
||||
where versionid = dbo.vefn_GetVersionIDByItemID(@ItemID)) ah
|
||||
cross apply xconfig.nodes('//Slave') t2(r2)
|
||||
if(@apple is null) -- Non PC P/C Item
|
||||
BEGIN -- Get maximum Applicabilty
|
||||
declare @n int
|
||||
select @n=max(xSlave.value('@index','int')) from (
|
||||
select versionID, Cast(config as xml) xConfig from DocVersions) t1
|
||||
cross apply xconfig.nodes('//Slave') tSlave(xSlave)
|
||||
if(@n is not null)
|
||||
begin -- Build a list based upon the maximum
|
||||
with cte(ii) as (select 1 ii union all select ii+1 from cte where ii < @n)
|
||||
select @apple = coalesce(@apple+',','') + cast(ii as varchar(max)) from cte
|
||||
end
|
||||
if(@apple is null)Set @Apple=''
|
||||
END
|
||||
end
|
||||
end
|
||||
***/
|
||||
return @apple
|
||||
END
|
||||
GO
|
||||
-- Display the status of TableFunction creation
|
||||
IF (@@Error = 0) PRINT 'Function: ve_GetItemDerivedApplicability Succeeded'
|
||||
ELSE PRINT 'Function: ve_GetItemDerivedApplicability Error on Creation'
|
||||
GO
|
||||
|
||||
-------
|
||||
/****** Object: UserDefinedFunction [dbo].[vefn_GetParentItem] Script Date: 03/28/2012 17:58:48 ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ve_GetParentItem]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
|
||||
DROP FUNCTION [ve_GetParentItem];
|
||||
@@ -13883,6 +13944,91 @@ GO
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getAllFormats Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getAllFormats Error on Creation'
|
||||
GO
|
||||
-----
|
||||
/****** Object: StoredProcedure [vesp_SearchSepcifiedApplicability] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_SearchSepcifiedApplicability]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_SearchSepcifiedApplicability];
|
||||
GO
|
||||
|
||||
/*
|
||||
exec vesp_SearchSepcifiedApplicability '16','','',0,0,0,0,'','3'
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2018 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE PROCEDURE [dbo].[vesp_SearchSepcifiedApplicability] (@DocVersionList varchar(MAX), @StepTypeList varchar(MAX),
|
||||
@SearchString varchar(MAX), @CaseSensitive as int, @IncludeLinks as int, @IncludeRtfFormatting as int, @IncludeSpecialCharacters as int, @UnitPrefix as varchar(MAX), @ApplicSetting varchar(MAX))
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
select ZZ.DvPath, ZZ.Path, ZZ.[Level],ZZ.[FromType],ZZ.[Ordinal], ZZ.[ParentID], ZZ.[ItemID],ZZ.[PreviousID],ZZ.[ContentID],ZZ.[DTS],ZZ.[UserID]
|
||||
,II.[LastChanged]
|
||||
,CC.[Number],CC.[Text],CC.[Type],CC.[FormatID],CC.[Config],CC.[DTS] [cDTS],CC.[UserID] [cUserID]
|
||||
,CC.[LastChanged] [cLastChanged],
|
||||
PP.[ContentID] [pContentID], PP.[DTS] [pDTS],PP.[UserID] [pUserID], PP.[LastChanged] [pLastChanged],
|
||||
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[ItemID]=ZZ.[ItemID]) [AnnotationCount],
|
||||
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[ItemID]=ZZ.[ItemID]) [DocVersionCount],
|
||||
(SELECT COUNT(*) FROM [Items] [Next] WHERE [Next].[PreviousID]=ZZ.[ItemID]) [NextCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ItemID]=ZZ.[ItemID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[RangeID]=ZZ.[ItemID]) [Transition_RangeIDCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[ToID]=ZZ.[ItemID]) [Transition_ToIDCount],
|
||||
(SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=CC.[ContentID]) [DetailCount],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=CC.[ContentID]) [EntryCount],
|
||||
(SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=CC.[ContentID]) [GridCount],
|
||||
(SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=CC.[ContentID]) [ImageCount],
|
||||
(SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=CC.[ContentID]) [ItemCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=CC.[ContentID]) [cPartCount],
|
||||
(SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=CC.[ContentID]) [RoUsageCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[FromID]=CC.[ContentID]) [TransitionCount],
|
||||
(SELECT COUNT(*) FROM [ZContents] WHERE [ZContents].[ContentID]=CC.[ContentID]) [ZContentCount]
|
||||
from vefn_SiblingAndChildrenItems(@DocVersionList, @UnitPrefix) ZZ
|
||||
Join Items II on ZZ.ItemID=II.ItemID
|
||||
Left Join Parts PP on ZZ.PContentID=PP.ContentID and ZZ.FromType = PP.FromType
|
||||
Join Contents CC on CC.ContentID=ZZ.ContentID
|
||||
where ZZ.ContentID in (select ContentID from vefn_FindSpecificApplicUsage(@DocVersionList, @ApplicSetting))
|
||||
order by DvPath,OrdinalPath
|
||||
GO
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_SearchSepcifiedApplicability Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_SearchSepcifiedApplicability Error on Creation'
|
||||
GO
|
||||
-----
|
||||
/****** Object: StoredProcedure [vefn_FindSpecificApplicUsage] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_FindSpecificApplicUsage]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_FindSpecificApplicUsage];
|
||||
GO
|
||||
|
||||
/*
|
||||
exec vefn_FindSpecificApplicUsage '16','3'
|
||||
*/
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2018 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE FUNCTION [dbo].[vefn_FindSpecificApplicUsage](
|
||||
@DocVersionList nvarchar(MAX)
|
||||
,@ApplicSetting varchar(MAX))
|
||||
RETURNS @FoundContents TABLE
|
||||
(
|
||||
ContentID int PRIMARY KEY
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
insert into @FoundContents
|
||||
select C.ContentID from (select * from Contents where ContentID in(select ContentID from vefn_DVContent(@DocVersionList))) C
|
||||
join
|
||||
items ii
|
||||
on ii.ContentID = C.ContentID
|
||||
where ','+ dbo.ve_GetItemAppliedApplicability(ii.ItemID ) + ',' like '%,' + @ApplicSetting + ',%'
|
||||
RETURN
|
||||
END
|
||||
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vefn_FindSpecificApplicUsage Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vefn_FindSpecificApplicUsage Error on Creation'
|
||||
GO
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
/*
|
||||
@@ -13909,8 +14055,8 @@ BEGIN TRY -- Try Block
|
||||
set nocount on
|
||||
DECLARE @RevDate varchar(255)
|
||||
DECLARE @RevDescription varchar(255)
|
||||
set @RevDate = '6/15/2018 09:37 AM'
|
||||
set @RevDescription = 'Fixed embedded degree characters'
|
||||
set @RevDate = '9/27/2018 10:09 AM'
|
||||
set @RevDescription = 'added vesp_SearchSepcifiedApplicability'
|
||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||
|
Reference in New Issue
Block a user