B2022-124: [JPR] Blank RO Values (All Spaces) printing as "?"
This commit is contained in:
parent
1fbda4c13b
commit
6712671d04
@ -21643,6 +21643,304 @@ GO
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
Begin: B2022-124: [JPR] Blank RO Values (All Spaces) printing as ?
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
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 = DataLength(@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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If Exists(SELECT * FROM sys.objects Where name = 'vefn_RofstDataCleanUnitInfoTags' AND type in (N'FN'))
|
||||||
|
DROP FUNCTION [dbo].[vefn_RofstDataCleanUnitInfoTags]
|
||||||
|
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: 06/21/2022
|
||||||
|
-- Description: Removes any legacy legacy unit info variables and fixes older applicability tags
|
||||||
|
-- ==========================================================================================
|
||||||
|
|
||||||
|
CREATE FUNCTION [dbo].[vefn_RofstDataCleanUnitInfoTags](@Values VarChar(Max), @RemoveUnitInfoVars bit = 0) Returns VarChar(Max)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
Declare @RetVal VarChar(Max) = @Values;
|
||||||
|
|
||||||
|
If (Len(@RetVal) > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
Set @RetVal = dbo.vefn_Clean(@Values, 1, null);
|
||||||
|
|
||||||
|
-- Make Sure all tag/var instances are upper case & Remove any internal spaces
|
||||||
|
Set @RetVal = Replace(@RetVal, 'U-OTHER TEXT', 'U-OTHERTEXT');
|
||||||
|
Set @RetVal = Replace(@RetVal, 'U-OTHER NUMBER', 'U-OTHERNUMBER');
|
||||||
|
Set @RetVal = Replace(@RetVal, 'U-OTHER NAME', 'U-OTHERNAME');
|
||||||
|
Set @RetVal = Replace(@RetVal, 'U-OTHER ID', 'U-OTHERID');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<u>', '<U-ID>');
|
||||||
|
|
||||||
|
If (@RemoveUnitInfoVars > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Remove any Unit Info Variables
|
||||||
|
Set @RetVal = Replace(@RetVal, '<u>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-ID>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-NUMBER>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-NAME>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-TEXT>', '');
|
||||||
|
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-OTHERID>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-OTHERNUMBER>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-OTHERNAME>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-OTHERTEXT>', '');
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Return @RetVal;
|
||||||
|
|
||||||
|
END
|
||||||
|
Go
|
||||||
|
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Function Creation: [vefn_RofstDataCleanUnitInfoTags] Succeeded'
|
||||||
|
ELSE PRINT 'Function Creation: [vefn_RofstDataCleanUnitInfoTags] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If Exists(SELECT * FROM sys.objects Where name = 'vesp_RofstChildInsert' AND type in (N'P'))
|
||||||
|
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,
|
||||||
|
@missingDefaultValue 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);
|
||||||
|
|
||||||
|
-- Default missing value if Null (Null values not allowed for the [value] field in the RofstDefaultValue table
|
||||||
|
if (DataLength(IsNull(@missingDefaultValue, '')) <= 0)
|
||||||
|
Set @missingDefaultValue = '[TBD]';
|
||||||
|
|
||||||
|
-- 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 (DataLength(cv.DefaultValue) > 0) Then dbo.vefn_RofstDataCleanUnitInfoTags(cv.DefaultValue, 0) Else @missingDefaultValue 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 (DataLength(@DefaultValues) > 0) Then dbo.vefn_RofstDataCleanUnitInfoTags(@DefaultValues, 0) Else @missingDefaultValue 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
End: B2022-124: [JPR] Blank RO Values (All Spaces) printing as ?
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@ -21678,8 +21976,8 @@ BEGIN TRY -- Try Block
|
|||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
|
|
||||||
set @RevDate = '09/21/2022 4:00 PM'
|
set @RevDate = '10/03/2022 2:00 PM'
|
||||||
set @RevDescription = 'B2022-121: [JPR] RO values containing curly braces around values that are NOT multi return values do not resolved in Word Sections.'
|
set @RevDescription = 'B2022-124: [JPR] Blank RO Values (All Spaces) printing as ?'
|
||||||
|
|
||||||
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
|
||||||
|
@ -21643,6 +21643,304 @@ GO
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
Begin: B2022-124: [JPR] Blank RO Values (All Spaces) printing as ?
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
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 = DataLength(@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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If Exists(SELECT * FROM sys.objects Where name = 'vefn_RofstDataCleanUnitInfoTags' AND type in (N'FN'))
|
||||||
|
DROP FUNCTION [dbo].[vefn_RofstDataCleanUnitInfoTags]
|
||||||
|
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: 06/21/2022
|
||||||
|
-- Description: Removes any legacy legacy unit info variables and fixes older applicability tags
|
||||||
|
-- ==========================================================================================
|
||||||
|
|
||||||
|
CREATE FUNCTION [dbo].[vefn_RofstDataCleanUnitInfoTags](@Values VarChar(Max), @RemoveUnitInfoVars bit = 0) Returns VarChar(Max)
|
||||||
|
WITH EXECUTE AS OWNER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
Declare @RetVal VarChar(Max) = @Values;
|
||||||
|
|
||||||
|
If (Len(@RetVal) > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
Set @RetVal = dbo.vefn_Clean(@Values, 1, null);
|
||||||
|
|
||||||
|
-- Make Sure all tag/var instances are upper case & Remove any internal spaces
|
||||||
|
Set @RetVal = Replace(@RetVal, 'U-OTHER TEXT', 'U-OTHERTEXT');
|
||||||
|
Set @RetVal = Replace(@RetVal, 'U-OTHER NUMBER', 'U-OTHERNUMBER');
|
||||||
|
Set @RetVal = Replace(@RetVal, 'U-OTHER NAME', 'U-OTHERNAME');
|
||||||
|
Set @RetVal = Replace(@RetVal, 'U-OTHER ID', 'U-OTHERID');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<u>', '<U-ID>');
|
||||||
|
|
||||||
|
If (@RemoveUnitInfoVars > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Remove any Unit Info Variables
|
||||||
|
Set @RetVal = Replace(@RetVal, '<u>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-ID>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-NUMBER>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-NAME>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-TEXT>', '');
|
||||||
|
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-OTHERID>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-OTHERNUMBER>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-OTHERNAME>', '');
|
||||||
|
Set @RetVal = Replace(@RetVal, '<U-OTHERTEXT>', '');
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Return @RetVal;
|
||||||
|
|
||||||
|
END
|
||||||
|
Go
|
||||||
|
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Function Creation: [vefn_RofstDataCleanUnitInfoTags] Succeeded'
|
||||||
|
ELSE PRINT 'Function Creation: [vefn_RofstDataCleanUnitInfoTags] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If Exists(SELECT * FROM sys.objects Where name = 'vesp_RofstChildInsert' AND type in (N'P'))
|
||||||
|
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,
|
||||||
|
@missingDefaultValue 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);
|
||||||
|
|
||||||
|
-- Default missing value if Null (Null values not allowed for the [value] field in the RofstDefaultValue table
|
||||||
|
if (DataLength(IsNull(@missingDefaultValue, '')) <= 0)
|
||||||
|
Set @missingDefaultValue = '[TBD]';
|
||||||
|
|
||||||
|
-- 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 (DataLength(cv.DefaultValue) > 0) Then dbo.vefn_RofstDataCleanUnitInfoTags(cv.DefaultValue, 0) Else @missingDefaultValue 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 (DataLength(@DefaultValues) > 0) Then dbo.vefn_RofstDataCleanUnitInfoTags(@DefaultValues, 0) Else @missingDefaultValue 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
End: B2022-124: [JPR] Blank RO Values (All Spaces) printing as ?
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@ -21678,8 +21976,8 @@ BEGIN TRY -- Try Block
|
|||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
|
|
||||||
set @RevDate = '09/21/2022 4:00 PM'
|
set @RevDate = '10/03/2022 2:00 PM'
|
||||||
set @RevDescription = 'B2022-121: [JPR] RO values containing curly braces around values that are NOT multi return values do not resolved in Word Sections.'
|
set @RevDescription = 'B2022-124: [JPR] Blank RO Values (All Spaces) printing as ?'
|
||||||
|
|
||||||
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
|
||||||
|
@ -127,8 +127,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public static Regex regRoKeyHigh = new Regex("( |-|_)(HIGH|HI)([0-9])");
|
public static Regex regRoKeyHigh = new Regex("( |-|_)(HIGH|HI)([0-9])");
|
||||||
public static Regex regRoKeyLow = new Regex("( |-|_)(LOW|LO)([0-9])");
|
public static Regex regRoKeyLow = new Regex("( |-|_)(LOW|LO)([0-9])");
|
||||||
|
|
||||||
public const string RoMissingDefaultValue = "[TBD]";
|
|
||||||
|
|
||||||
private List<RoExtension> _extensions;
|
private List<RoExtension> _extensions;
|
||||||
private List<string> _baseAccPageKeys;
|
private List<string> _baseAccPageKeys;
|
||||||
|
|
||||||
@ -137,7 +135,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private DocVersionInfo _myDocVersionInfo;
|
private DocVersionInfo _myDocVersionInfo;
|
||||||
private int _selectedSlave;
|
private int _selectedSlave;
|
||||||
private string _otherChild = string.Empty;
|
private string _otherChild = string.Empty;
|
||||||
|
private string _roMissingDefaultValue = "[TBD]";
|
||||||
|
|
||||||
private bool _autoCombineSingleRetValues = true;
|
private bool _autoCombineSingleRetValues = true;
|
||||||
|
|
||||||
private List<string> _lstRoValues;
|
private List<string> _lstRoValues;
|
||||||
@ -194,6 +193,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
set { _itemInfo = value; }
|
set { _itemInfo = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// B2022-124: [JPR] Blank RO Values (All Spaces) printing as "?"
|
||||||
|
public string RoMissingDefaultValue
|
||||||
|
{
|
||||||
|
get { return _roMissingDefaultValue; }
|
||||||
|
set { _roMissingDefaultValue = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public List<RoExtension> Extensions
|
public List<RoExtension> Extensions
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -872,6 +878,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (!string.IsNullOrEmpty(value))
|
if (!string.IsNullOrEmpty(value))
|
||||||
cmd.Parameters.Add(new SqlParameter("@value", SqlDbType.VarChar)).Value = value;
|
cmd.Parameters.Add(new SqlParameter("@value", SqlDbType.VarChar)).Value = value;
|
||||||
|
|
||||||
|
// B2022-124: [JPR] Blank RO Values (All Spaces) printing as "?"
|
||||||
|
if (!string.IsNullOrEmpty(this.RoMissingDefaultValue))
|
||||||
|
cmd.Parameters.Add(new SqlParameter("@missingDefaultValue", SqlDbType.VarChar)).Value = this.RoMissingDefaultValue;
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1131,7 +1141,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
cmd.Parameters.Add(new SqlParameter("@Value", SqlDbType.VarChar)).Value = value;
|
cmd.Parameters.Add(new SqlParameter("@Value", SqlDbType.VarChar)).Value = value;
|
||||||
cmd.Parameters.Add(new SqlParameter("@SearchTypeID", SqlDbType.Int)).Value = searchTypeID;
|
cmd.Parameters.Add(new SqlParameter("@SearchTypeID", SqlDbType.Int)).Value = searchTypeID;
|
||||||
cmd.Parameters.Add(new SqlParameter("@OnlyRoid16", SqlDbType.Bit)).Value = (onlyRoid16) ? 1 : 0;
|
cmd.Parameters.Add(new SqlParameter("@OnlyRoid16", SqlDbType.Bit)).Value = (onlyRoid16) ? 1 : 0;
|
||||||
|
|
||||||
if (maxNumRecords != null)
|
if (maxNumRecords != null)
|
||||||
cmd.Parameters.Add(new SqlParameter("@MaxNumOfRecords", SqlDbType.Int)).Value = (int)maxNumRecords;
|
cmd.Parameters.Add(new SqlParameter("@MaxNumOfRecords", SqlDbType.Int)).Value = (int)maxNumRecords;
|
||||||
|
|
||||||
@ -1759,7 +1769,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
// setting appid and roid
|
// setting appid and roid
|
||||||
var roExt = lstValues.Count==1? Extensions.Where(x => x.Offset.Equals(i + 1)).SingleOrDefault() : Extensions.Where(x => x.AccPageExt.Equals(_multiRoValues[i])).SingleOrDefault();
|
var roExt = lstValues.Count==1? Extensions.Where(x => x.Offset.Equals(i + 1)).SingleOrDefault() : Extensions.Where(x => x.AccPageExt.Equals(_multiRoValues[i])).SingleOrDefault();
|
||||||
|
|
||||||
string roValue = GetParentChildROValue(lstValues[i], this.SelectedSlave);
|
// B2022-124: [JPR] Blank RO Values (All Spaces) printing as "?"
|
||||||
|
string roValue = GetParentChildROValue(lstValues[i], this.SelectedSlave, this.RoMissingDefaultValue);
|
||||||
|
|
||||||
child.children[i].ParentID = child.ID;
|
child.children[i].ParentID = child.ID;
|
||||||
child.children[i].type = child.type; // Multiple return value inherit type from parent
|
child.children[i].type = child.type; // Multiple return value inherit type from parent
|
||||||
@ -1796,12 +1807,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetParentChildROValue(string roval, int selChldIdx)
|
private static string GetParentChildROValue(string roval, int selChldIdx, string roMissingDefaultValue)
|
||||||
{
|
{
|
||||||
// C2021-026 Get the child RO value if it exists, otherwise to the default (parent) RO value
|
// C2021-026 Get the child RO value if it exists, otherwise to the default (parent) RO value
|
||||||
// C2022-001 new logic to handle new format of Parent/Child RO.FST
|
// C2022-001 new logic to handle new format of Parent/Child RO.FST
|
||||||
// The RO.FST will not have a specific child value if that child value is the same as the default value
|
// The RO.FST will not have a specific child value if that child value is the same as the default value
|
||||||
// B2021-093 Don't look for child RO values if "roval" is null
|
// B2021-093 Don't look for child RO values if "roval" is null
|
||||||
|
// B2022-124: [JPR] Blank RO Values (All Spaces) printing as "?", Added roMissingDefaultValue parameter
|
||||||
if (string.IsNullOrEmpty(roval))
|
if (string.IsNullOrEmpty(roval))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -1854,7 +1866,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If Default Value is selected (selChldIdx = 0), and return value is empty then replace with Standard Missing Default Value
|
// If Default Value is selected (selChldIdx = 0), and return value is empty then replace with Standard Missing Default Value
|
||||||
return (selChldIdx == 0 && sb.ToString().Trim().Length <= 0) ? ROFSTLookup.RoMissingDefaultValue : sb.ToString().Trim();
|
// TODO: [JAKE]
|
||||||
|
return (selChldIdx == 0 && sb.ToString().Length <= 0) ? roMissingDefaultValue : sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<string> GetROReturnValue(string roval)
|
private List<string> GetROReturnValue(string roval)
|
||||||
|
@ -168,13 +168,6 @@ namespace Volian.Controls.Library
|
|||||||
tvROFST.SelectedNode = null;
|
tvROFST.SelectedNode = null;
|
||||||
ResetSearch();
|
ResetSearch();
|
||||||
|
|
||||||
//tbROValue.Text = null;
|
|
||||||
//lbROId.Text = string.Empty;
|
|
||||||
|
|
||||||
//btnGoToRO.Enabled = false;
|
|
||||||
//btnSaveRO.Enabled = false;
|
|
||||||
//btnCancelRO.Enabled = false;
|
|
||||||
//btnPreviewRO.Enabled = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -640,11 +633,6 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
_curROTypeFilter = _roTypeFilter;
|
_curROTypeFilter = _roTypeFilter;
|
||||||
|
|
||||||
|
|
||||||
//_curROFST = _myROFST;
|
|
||||||
//_curROFSTLookup = _myROFSTLookup;
|
|
||||||
//_curROTypeFilter = _roTypeFilter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFindDocROButton(bool enabled)
|
public void SetFindDocROButton(bool enabled)
|
||||||
@ -1027,7 +1015,15 @@ namespace Volian.Controls.Library
|
|||||||
// tries to process a search while the main tab/procedure is closing
|
// tries to process a search while the main tab/procedure is closing
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
searchValue = (!string.IsNullOrEmpty(searchValue)) ? searchValue.Replace('\u2011', '-').Replace(@"\u9586?", @"\\").Trim() : searchValue;
|
// B2022-124: [JPR] Blank RO Values (All Spaces) printing as "?"
|
||||||
|
if (!string.IsNullOrEmpty(searchValue))
|
||||||
|
{
|
||||||
|
searchValue = searchValue.Replace('\u2011', '-');
|
||||||
|
searchValue = searchValue.Replace(@"\u9586?", @"\\");
|
||||||
|
|
||||||
|
if (searchValue.Replace(" ", string.Empty).Length > 0)
|
||||||
|
searchValue = searchValue.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.Enabled && !string.IsNullOrEmpty(searchValue) && searchValue.Length >= 2 && !searchValue.Contains("#Link:Transition"))
|
if (this.Enabled && !string.IsNullOrEmpty(searchValue) && searchValue.Length >= 2 && !searchValue.Contains("#Link:Transition"))
|
||||||
{
|
{
|
||||||
@ -1036,7 +1032,7 @@ namespace Volian.Controls.Library
|
|||||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||||
if (searchValue.StartsWith("<") && searchValue.EndsWith(">")) // RO Link (accPageID)
|
if (searchValue.StartsWith("<") && searchValue.EndsWith(">")) // RO Link (accPageID)
|
||||||
{
|
{
|
||||||
ROFSTLookup.rochild roc = MyROFSTLookup.GetROChildByAccPageID(searchValue);
|
ROFSTLookup.rochild roc = MyROFSTLookup.GetROChildByAccPageID(searchValue);
|
||||||
|
|
||||||
// If RO is valid then select node in tree view
|
// If RO is valid then select node in tree view
|
||||||
|
Loading…
x
Reference in New Issue
Block a user