From 29794ec5a9314f6a858fd066188f4259477e0de9 Mon Sep 17 00:00:00 2001 From: Rich Date: Mon, 22 Aug 2016 20:27:42 +0000 Subject: [PATCH] Added some debug code for testing the function above. After the code was finished, the debug code was commented-out. --- PROMS/DataLoader/PROMSFixes.Sql | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index 82264a92..5520bcc2 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -5277,6 +5277,11 @@ select [dbo].[ve_GetItemDerivedApplicability](49) select [dbo].[ve_GetItemDerivedApplicability](50) select [dbo].[ve_GetItemDerivedApplicability](51) select [dbo].[ve_GetItemDerivedApplicability](52) +--Prairie Island +select [dbo].[ve_GetItemDerivedApplicability](29544) [ParentChild] +select [dbo].[ve_GetItemDerivedApplicability](123816) [ParentChild] +select [dbo].[ve_GetItemDerivedApplicability](125916) [ParentChild] +select [dbo].[ve_GetItemDerivedApplicability](26955) [NonParentChild] */ /***************************************************************************** Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE @@ -5296,12 +5301,23 @@ BEGIN set @apple = dbo.ve_GetItemDerivedApplicability(@ParentID) else begin - set @apple = '' 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) - set @apple = substring(@apple,2,len(@apple)) + 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 @@ -13111,8 +13127,8 @@ BEGIN TRY -- Try Block set nocount on DECLARE @RevDate varchar(255) DECLARE @RevDescription varchar(255) - set @RevDate = '7/8/2016 12:55 PM' - set @RevDescription = 'Fix for searching for Register symbol' + set @RevDate = '8/22/2016 8:30 AM' + set @RevDescription = 'Updated ve_GetItemDerivedApplicability for Non PC P/C Procedure Sets (Maximum Applicability)' Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription IF( @@TRANCOUNT > 0 ) COMMIT