B2022-121: RO values containing curly braces around values that are NOT multi return values do not resolved in Word Sections.
This commit is contained in:
parent
1d0dee974c
commit
7c9a722eba
@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
Set NoCount On;
|
||||||
|
|
||||||
If (db_name() in('master','model','msdn','tempdb'))
|
If (db_name() in('master','model','msdn','tempdb'))
|
||||||
begin
|
begin
|
||||||
DECLARE @ErrorMsg varchar(255)
|
DECLARE @ErrorMsg varchar(255)
|
||||||
@ -21405,21 +21407,242 @@ Begin
|
|||||||
End
|
End
|
||||||
Go
|
Go
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IF (@@Error = 0) PRINT 'Function Creation: [FindRoUsages] Succeeded'
|
IF (@@Error = 0) PRINT 'Function Creation: [FindRoUsages] Succeeded'
|
||||||
ELSE PRINT 'Function Creation: [FindRoUsages] Error on Creation'
|
ELSE PRINT 'Function Creation: [FindRoUsages] Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==========================================================================================================
|
==========================================================================================================
|
||||||
End: B2022-104: SearchReferenced Objects in PROMS is not finding any results
|
End: B2022-104: SearchReferenced Objects in PROMS is not finding any results
|
||||||
==========================================================================================================
|
==========================================================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
Begin: B2022-121: RO values containing curly braces around values that are NOT multi return values do not resolved in Word Sections.
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
IF EXISTS (Select * From dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[vesp_RofstChildInsert]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP Procedure [dbo].[vesp_RofstChildInsert];
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
Author: Jake Ropar
|
||||||
|
Create Date: 03/24/2022
|
||||||
|
Description: Inserts the RO Child object and associated return values
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
Create Procedure [dbo].[vesp_RofstChildInsert]
|
||||||
|
(
|
||||||
|
@RofstID Int,
|
||||||
|
@ID Int,
|
||||||
|
@ParentID Int,
|
||||||
|
@dbiID Int,
|
||||||
|
@type Int,
|
||||||
|
@title VarChar(Max),
|
||||||
|
@roid VarChar(50),
|
||||||
|
@appid VarChar(Max) = null,
|
||||||
|
@value VarChar(Max) = null
|
||||||
|
)
|
||||||
|
With Execute as Owner
|
||||||
|
As
|
||||||
|
Begin
|
||||||
|
|
||||||
|
Declare @BaseAccPageID VarChar(Max) = null;
|
||||||
|
Declare @DefaultValues VarChar(Max);
|
||||||
|
|
||||||
|
Declare @RoidExt VarChar(Max);
|
||||||
|
Declare @AccPageExt VarChar(Max);
|
||||||
|
|
||||||
|
|
||||||
|
-- Create Rofst Child/Group Record --> [Roid = (12) Digits]
|
||||||
|
Insert Into RofstChild (RofstID, ID, ParentID, dbiID, [type], title, roid, appid, [value])
|
||||||
|
Values (@RofstID, @ID, @ParentID, @dbiID, @type, @title, @roid, @appid, @value);
|
||||||
|
|
||||||
|
|
||||||
|
-- Check for appid, if exists, then insert the default value for each return type if multi-value
|
||||||
|
If (Len(@appid) > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Get Accessory Page ID
|
||||||
|
Select @BaseAccPageID = dbo.vefn_RofstDataCleanUnitInfoTags(Concat(d.dbiAP, '-', @appid), 1)
|
||||||
|
From RofstDatabase d with (NoLock)
|
||||||
|
Where d.RofstID = @RofstID And d.dbiID = @dbiID;
|
||||||
|
|
||||||
|
Select @DefaultValues = dbo.vefn_RofstDataReplaceVars(@value);
|
||||||
|
|
||||||
|
If (PatIndex('%=%', @DefaultValues) > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Insert Rofst Default Values (Multi-Values) --> [Roid = (16) Digits]
|
||||||
|
Select @DefaultValues = Replace(@DefaultValues, '{', '');
|
||||||
|
|
||||||
|
With ChildrenValues as
|
||||||
|
(
|
||||||
|
Select x.ListPosition as 'OffsetIndex',
|
||||||
|
Case When (PatIndex('%=%', x.ListValue) > 0) Then Right(x.ListValue, Len(x.ListValue)-PatIndex('%=%', x.ListValue)) Else x.ListValue End as 'DefaultValue'
|
||||||
|
From [dbo].[vefn_ParseStringListToTable](@DefaultValues, '}') x
|
||||||
|
Where Len(x.ListValue) > 0
|
||||||
|
)
|
||||||
|
Insert Into RofstDefaultValue (RofstID, roid, [value], AccPageID)
|
||||||
|
Select @RofstID as 'RofstID',
|
||||||
|
Concat(@roid, re.RoidExt) as 'roid',
|
||||||
|
Case When (Len(RTrim(LTrim(cv.DefaultValue))) > 0 ) Then dbo.vefn_RofstDataCleanUnitInfoTags(cv.DefaultValue, 0) Else '[TBD]' End as 'value',
|
||||||
|
Concat(@BaseAccPageID, '.', re.AccPageExt) as 'AccPageID'
|
||||||
|
From ChildrenValues cv
|
||||||
|
inner join vwRofstData_RofstExtensions re on re.Offset = cv.OffsetIndex
|
||||||
|
Order By cv.OffsetIndex Asc
|
||||||
|
|
||||||
|
End
|
||||||
|
Else
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Insert Rofst Default Value (Single Value) --> [Roid = (16) Digits]
|
||||||
|
Insert Into RofstDefaultValue (RofstID, roid, [value], AccPageID)
|
||||||
|
Select @RofstID as 'RofstID',
|
||||||
|
Concat(@roid, re.RoidExt) as 'roid',
|
||||||
|
Case When (Len(RTrim(LTrim(@DefaultValues))) > 0 ) Then dbo.vefn_RofstDataCleanUnitInfoTags(@DefaultValues, 0) Else '[TBD]' End as 'value',
|
||||||
|
Concat(@BaseAccPageID, '.', re.AccPageExt) as 'AccPageID'
|
||||||
|
From vwRofstData_RofstExtensions re
|
||||||
|
Where re.Offset = 1;
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
End -- (Len(@appid) > 0)
|
||||||
|
|
||||||
|
|
||||||
|
Return;
|
||||||
|
|
||||||
|
End
|
||||||
|
Go
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: [vesp_RofstChildInsert] Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: [vesp_RofstChildInsert] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If Exists(SELECT * FROM sys.objects Where name = 'vefn_RofstDataReplaceVars' AND type in (N'FN'))
|
||||||
|
DROP FUNCTION [dbo].[vefn_RofstDataReplaceVars]
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
-- ==========================================================================================
|
||||||
|
-- Author: Jake Ropar
|
||||||
|
-- Create Date: 3/25/2022
|
||||||
|
-- Description: Replaces Any Variables and returns the rest of the value string
|
||||||
|
-- ==========================================================================================
|
||||||
|
|
||||||
|
CREATE FUNCTION [dbo].[vefn_RofstDataReplaceVars](@Values VarChar(Max)) Returns VarChar(Max)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
Declare @RetVal VarChar(Max) = '';
|
||||||
|
Declare @EqualsIndex Int;
|
||||||
|
Declare @EndIndex Int;
|
||||||
|
Declare @NameValPairStartIndex Int;
|
||||||
|
Declare @NameValPairEndIndex Int;
|
||||||
|
|
||||||
|
Declare @VarPair VarChar(Max);
|
||||||
|
Declare @VarName VarChar(Max);
|
||||||
|
Declare @VarValue VarChar(Max);
|
||||||
|
|
||||||
|
-- Replace Any "<APL /APL>" Tags with the Default Value first
|
||||||
|
Select @RetVal = dbo.vefn_RofstDataReplaceApplTagsWithDefaults(@Values);
|
||||||
|
|
||||||
|
-- Replace Any Legacy Applicability Tags with the Default Value second
|
||||||
|
Select @RetVal = dbo.vefn_RofstDataReplaceLegacyTagsWithDefaults(@RetVal);
|
||||||
|
|
||||||
|
If (PatIndex('%=%', @RetVal) > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
If (PatIndex('%{{A%', @RetVal) > 0)
|
||||||
|
Set @EndIndex = PatIndex('%{{A%', @RetVal);
|
||||||
|
Else
|
||||||
|
Set @EndIndex = Len(@RetVal) -1;
|
||||||
|
|
||||||
|
Set @NameValPairStartIndex = PatIndex('%{%', @RetVal);
|
||||||
|
Set @NameValPairEndIndex = PatIndex('%}%', @RetVal);
|
||||||
|
|
||||||
|
While(@NameValPairStartIndex > 0 And @NameValPairStartIndex < @EndIndex)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Get Name Value Pair [ex. {EGS=1214}]
|
||||||
|
Set @VarPair = SubString(@RetVal, @NameValPairStartIndex, (@NameValPairEndIndex - @NameValPairStartIndex) + 1);
|
||||||
|
|
||||||
|
-- Remove Name Value Pair From Return Val
|
||||||
|
Set @RetVal = Replace(@RetVal, @VarPair, '');
|
||||||
|
|
||||||
|
-- Get Variable Name and Value
|
||||||
|
Set @EqualsIndex = PatIndex('%=%', @VarPair);
|
||||||
|
|
||||||
|
If (@EqualsIndex > 0)
|
||||||
|
Begin
|
||||||
|
Set @VarName = SubString(@VarPair, 2, @EqualsIndex - 2);
|
||||||
|
Set @VarValue = SubString(@VarPair, @EqualsIndex + 1, Len(@VarPair) - @EqualsIndex - 1);
|
||||||
|
Set @VarName = Concat('{', @VarName, '}');
|
||||||
|
|
||||||
|
-- Replace All Occurences
|
||||||
|
Set @RetVal = Replace(@RetVal, @VarName, @VarValue);
|
||||||
|
End
|
||||||
|
|
||||||
|
-- Get Updated Index Values
|
||||||
|
If (PatIndex('%{{A%', @RetVal) > 0)
|
||||||
|
Set @EndIndex = PatIndex('%{{A%', @RetVal);
|
||||||
|
Else
|
||||||
|
Set @EndIndex = Len(@RetVal) -1;
|
||||||
|
|
||||||
|
Set @NameValPairStartIndex = PatIndex('%{%', @RetVal);
|
||||||
|
Set @NameValPairEndIndex = PatIndex('%}%', @RetVal);
|
||||||
|
|
||||||
|
End -- End While(@ReplaceVarEndTagIndex > 0)
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Return @RetVal;
|
||||||
|
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Function Creation: [vefn_RofstDataReplaceVars] Succeeded'
|
||||||
|
ELSE PRINT 'Function Creation: [vefn_RofstDataReplaceVars] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
End: B2022-121: RO values containing curly braces around values that are NOT multi return values do not resolved in Word Sections.
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@ -21455,8 +21678,8 @@ BEGIN TRY -- Try Block
|
|||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
|
|
||||||
set @RevDate = '08/23/2022 7:00 AM'
|
set @RevDate = '09/21/2022 4:00 PM'
|
||||||
set @RevDescription = 'B2022-104: [JPR] SearchReferenced Objects in PROMS is not finding any results'
|
set @RevDescription = 'B2022-121: [JPR] RO values containing curly braces around values that are NOT multi return values do not resolved in Word Sections.'
|
||||||
|
|
||||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
Set NoCount On;
|
||||||
|
|
||||||
If (db_name() in('master','model','msdn','tempdb'))
|
If (db_name() in('master','model','msdn','tempdb'))
|
||||||
begin
|
begin
|
||||||
DECLARE @ErrorMsg varchar(255)
|
DECLARE @ErrorMsg varchar(255)
|
||||||
@ -21405,21 +21407,242 @@ Begin
|
|||||||
End
|
End
|
||||||
Go
|
Go
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IF (@@Error = 0) PRINT 'Function Creation: [FindRoUsages] Succeeded'
|
IF (@@Error = 0) PRINT 'Function Creation: [FindRoUsages] Succeeded'
|
||||||
ELSE PRINT 'Function Creation: [FindRoUsages] Error on Creation'
|
ELSE PRINT 'Function Creation: [FindRoUsages] Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==========================================================================================================
|
==========================================================================================================
|
||||||
End: B2022-104: SearchReferenced Objects in PROMS is not finding any results
|
End: B2022-104: SearchReferenced Objects in PROMS is not finding any results
|
||||||
==========================================================================================================
|
==========================================================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
Begin: B2022-121: RO values containing curly braces around values that are NOT multi return values do not resolved in Word Sections.
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
IF EXISTS (Select * From dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[vesp_RofstChildInsert]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP Procedure [dbo].[vesp_RofstChildInsert];
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
Author: Jake Ropar
|
||||||
|
Create Date: 03/24/2022
|
||||||
|
Description: Inserts the RO Child object and associated return values
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
Create Procedure [dbo].[vesp_RofstChildInsert]
|
||||||
|
(
|
||||||
|
@RofstID Int,
|
||||||
|
@ID Int,
|
||||||
|
@ParentID Int,
|
||||||
|
@dbiID Int,
|
||||||
|
@type Int,
|
||||||
|
@title VarChar(Max),
|
||||||
|
@roid VarChar(50),
|
||||||
|
@appid VarChar(Max) = null,
|
||||||
|
@value VarChar(Max) = null
|
||||||
|
)
|
||||||
|
With Execute as Owner
|
||||||
|
As
|
||||||
|
Begin
|
||||||
|
|
||||||
|
Declare @BaseAccPageID VarChar(Max) = null;
|
||||||
|
Declare @DefaultValues VarChar(Max);
|
||||||
|
|
||||||
|
Declare @RoidExt VarChar(Max);
|
||||||
|
Declare @AccPageExt VarChar(Max);
|
||||||
|
|
||||||
|
|
||||||
|
-- Create Rofst Child/Group Record --> [Roid = (12) Digits]
|
||||||
|
Insert Into RofstChild (RofstID, ID, ParentID, dbiID, [type], title, roid, appid, [value])
|
||||||
|
Values (@RofstID, @ID, @ParentID, @dbiID, @type, @title, @roid, @appid, @value);
|
||||||
|
|
||||||
|
|
||||||
|
-- Check for appid, if exists, then insert the default value for each return type if multi-value
|
||||||
|
If (Len(@appid) > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Get Accessory Page ID
|
||||||
|
Select @BaseAccPageID = dbo.vefn_RofstDataCleanUnitInfoTags(Concat(d.dbiAP, '-', @appid), 1)
|
||||||
|
From RofstDatabase d with (NoLock)
|
||||||
|
Where d.RofstID = @RofstID And d.dbiID = @dbiID;
|
||||||
|
|
||||||
|
Select @DefaultValues = dbo.vefn_RofstDataReplaceVars(@value);
|
||||||
|
|
||||||
|
If (PatIndex('%=%', @DefaultValues) > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Insert Rofst Default Values (Multi-Values) --> [Roid = (16) Digits]
|
||||||
|
Select @DefaultValues = Replace(@DefaultValues, '{', '');
|
||||||
|
|
||||||
|
With ChildrenValues as
|
||||||
|
(
|
||||||
|
Select x.ListPosition as 'OffsetIndex',
|
||||||
|
Case When (PatIndex('%=%', x.ListValue) > 0) Then Right(x.ListValue, Len(x.ListValue)-PatIndex('%=%', x.ListValue)) Else x.ListValue End as 'DefaultValue'
|
||||||
|
From [dbo].[vefn_ParseStringListToTable](@DefaultValues, '}') x
|
||||||
|
Where Len(x.ListValue) > 0
|
||||||
|
)
|
||||||
|
Insert Into RofstDefaultValue (RofstID, roid, [value], AccPageID)
|
||||||
|
Select @RofstID as 'RofstID',
|
||||||
|
Concat(@roid, re.RoidExt) as 'roid',
|
||||||
|
Case When (Len(RTrim(LTrim(cv.DefaultValue))) > 0 ) Then dbo.vefn_RofstDataCleanUnitInfoTags(cv.DefaultValue, 0) Else '[TBD]' End as 'value',
|
||||||
|
Concat(@BaseAccPageID, '.', re.AccPageExt) as 'AccPageID'
|
||||||
|
From ChildrenValues cv
|
||||||
|
inner join vwRofstData_RofstExtensions re on re.Offset = cv.OffsetIndex
|
||||||
|
Order By cv.OffsetIndex Asc
|
||||||
|
|
||||||
|
End
|
||||||
|
Else
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Insert Rofst Default Value (Single Value) --> [Roid = (16) Digits]
|
||||||
|
Insert Into RofstDefaultValue (RofstID, roid, [value], AccPageID)
|
||||||
|
Select @RofstID as 'RofstID',
|
||||||
|
Concat(@roid, re.RoidExt) as 'roid',
|
||||||
|
Case When (Len(RTrim(LTrim(@DefaultValues))) > 0 ) Then dbo.vefn_RofstDataCleanUnitInfoTags(@DefaultValues, 0) Else '[TBD]' End as 'value',
|
||||||
|
Concat(@BaseAccPageID, '.', re.AccPageExt) as 'AccPageID'
|
||||||
|
From vwRofstData_RofstExtensions re
|
||||||
|
Where re.Offset = 1;
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
End -- (Len(@appid) > 0)
|
||||||
|
|
||||||
|
|
||||||
|
Return;
|
||||||
|
|
||||||
|
End
|
||||||
|
Go
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: [vesp_RofstChildInsert] Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: [vesp_RofstChildInsert] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If Exists(SELECT * FROM sys.objects Where name = 'vefn_RofstDataReplaceVars' AND type in (N'FN'))
|
||||||
|
DROP FUNCTION [dbo].[vefn_RofstDataReplaceVars]
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
*****************************************************************************/
|
||||||
|
-- ==========================================================================================
|
||||||
|
-- Author: Jake Ropar
|
||||||
|
-- Create Date: 3/25/2022
|
||||||
|
-- Description: Replaces Any Variables and returns the rest of the value string
|
||||||
|
-- ==========================================================================================
|
||||||
|
|
||||||
|
CREATE FUNCTION [dbo].[vefn_RofstDataReplaceVars](@Values VarChar(Max)) Returns VarChar(Max)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
Declare @RetVal VarChar(Max) = '';
|
||||||
|
Declare @EqualsIndex Int;
|
||||||
|
Declare @EndIndex Int;
|
||||||
|
Declare @NameValPairStartIndex Int;
|
||||||
|
Declare @NameValPairEndIndex Int;
|
||||||
|
|
||||||
|
Declare @VarPair VarChar(Max);
|
||||||
|
Declare @VarName VarChar(Max);
|
||||||
|
Declare @VarValue VarChar(Max);
|
||||||
|
|
||||||
|
-- Replace Any "<APL /APL>" Tags with the Default Value first
|
||||||
|
Select @RetVal = dbo.vefn_RofstDataReplaceApplTagsWithDefaults(@Values);
|
||||||
|
|
||||||
|
-- Replace Any Legacy Applicability Tags with the Default Value second
|
||||||
|
Select @RetVal = dbo.vefn_RofstDataReplaceLegacyTagsWithDefaults(@RetVal);
|
||||||
|
|
||||||
|
If (PatIndex('%=%', @RetVal) > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
If (PatIndex('%{{A%', @RetVal) > 0)
|
||||||
|
Set @EndIndex = PatIndex('%{{A%', @RetVal);
|
||||||
|
Else
|
||||||
|
Set @EndIndex = Len(@RetVal) -1;
|
||||||
|
|
||||||
|
Set @NameValPairStartIndex = PatIndex('%{%', @RetVal);
|
||||||
|
Set @NameValPairEndIndex = PatIndex('%}%', @RetVal);
|
||||||
|
|
||||||
|
While(@NameValPairStartIndex > 0 And @NameValPairStartIndex < @EndIndex)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Get Name Value Pair [ex. {EGS=1214}]
|
||||||
|
Set @VarPair = SubString(@RetVal, @NameValPairStartIndex, (@NameValPairEndIndex - @NameValPairStartIndex) + 1);
|
||||||
|
|
||||||
|
-- Remove Name Value Pair From Return Val
|
||||||
|
Set @RetVal = Replace(@RetVal, @VarPair, '');
|
||||||
|
|
||||||
|
-- Get Variable Name and Value
|
||||||
|
Set @EqualsIndex = PatIndex('%=%', @VarPair);
|
||||||
|
|
||||||
|
If (@EqualsIndex > 0)
|
||||||
|
Begin
|
||||||
|
Set @VarName = SubString(@VarPair, 2, @EqualsIndex - 2);
|
||||||
|
Set @VarValue = SubString(@VarPair, @EqualsIndex + 1, Len(@VarPair) - @EqualsIndex - 1);
|
||||||
|
Set @VarName = Concat('{', @VarName, '}');
|
||||||
|
|
||||||
|
-- Replace All Occurences
|
||||||
|
Set @RetVal = Replace(@RetVal, @VarName, @VarValue);
|
||||||
|
End
|
||||||
|
|
||||||
|
-- Get Updated Index Values
|
||||||
|
If (PatIndex('%{{A%', @RetVal) > 0)
|
||||||
|
Set @EndIndex = PatIndex('%{{A%', @RetVal);
|
||||||
|
Else
|
||||||
|
Set @EndIndex = Len(@RetVal) -1;
|
||||||
|
|
||||||
|
Set @NameValPairStartIndex = PatIndex('%{%', @RetVal);
|
||||||
|
Set @NameValPairEndIndex = PatIndex('%}%', @RetVal);
|
||||||
|
|
||||||
|
End -- End While(@ReplaceVarEndTagIndex > 0)
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Return @RetVal;
|
||||||
|
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Function Creation: [vefn_RofstDataReplaceVars] Succeeded'
|
||||||
|
ELSE PRINT 'Function Creation: [vefn_RofstDataReplaceVars] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
End: B2022-121: RO values containing curly braces around values that are NOT multi return values do not resolved in Word Sections.
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@ -21455,8 +21678,8 @@ BEGIN TRY -- Try Block
|
|||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
|
|
||||||
set @RevDate = '08/23/2022 7:00 AM'
|
set @RevDate = '09/21/2022 4:00 PM'
|
||||||
set @RevDescription = 'B2022-104: [JPR] SearchReferenced Objects in PROMS is not finding any results'
|
set @RevDescription = 'B2022-121: [JPR] RO values containing curly braces around values that are NOT multi return values do not resolved in Word Sections.'
|
||||||
|
|
||||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||||
|
@ -1373,7 +1373,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
|
|
||||||
// Check the end of the AccPageID to determine if its an extension or part of the base key
|
// Check the end of the AccPageID to determine if its an extension or part of the base key
|
||||||
// If the AccPageID doesn't have an extension then set to default
|
// If the AccPageID doesn't have an extension then set to default
|
||||||
if (!Regex.IsMatch(accPageID, @".*\.[A-Z]") || BaseAccPageKeys.Contains(accPageID))
|
// B2022-121: RO values containing curly braces around values that are NOT multi return values do not resolved in Word Sections.
|
||||||
|
if (!Regex.IsMatch(accPageID.Substring(accPageID.Length - 2, 2), @".*\.[A-Z]") || BaseAccPageKeys.Contains(accPageID))
|
||||||
{
|
{
|
||||||
// No Extension, set to default
|
// No Extension, set to default
|
||||||
accPageID = string.Format("{0}.A", accPageID);
|
accPageID = string.Format("{0}.A", accPageID);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user