B2022-124: [JPR] Blank RO Values (All Spaces) printing as "?"
This commit is contained in:
@@ -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 @RevDescription varchar(255)
|
||||
|
||||
set @RevDate = '09/21/2022 4: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 @RevDate = '10/03/2022 2:00 PM'
|
||||
set @RevDescription = 'B2022-124: [JPR] Blank RO Values (All Spaces) printing as ?'
|
||||
|
||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||
|
Reference in New Issue
Block a user