MODULE DESCRIPTION: Provides named variable storage and retrieval for the framework. The variable names are NOT case-sensitive and are stored as ALL upper case.Declarations Constants Global Variables User-Defined Types Routine Details
Sub InitSAFSConstants BasicLib DDVariableStore Function DDVGetVariableValue BasicLib DDVariableStore Function DDVSetVariableValue BasicLib DDVariableStore Sub DDVClearAllVariables BasicLib DDVariableStore Function DDVSubstituteVariables BasicLib DDVariableStore Function DDVExtractVariables BasicLib DDVariableStore Function DDVProcessExpression BasicLib DDVariableStore Function DDVProcessFieldExpressions BasicLib DDVariableStore
' Framework constants Const SAFS_PROJECT_DIRECTORY = "SAFSPROJECTDIRECTORY" Const SAFS_DATAPOOL_DIRECTORY = "SAFSDATAPOOLDIRECTORY" Const SAFS_BENCH_DIRECTORY = "SAFSBENCHDIRECTORY" Const SAFS_TEST_DIRECTORY = "SAFSTESTDIRECTORY" Const SAFS_DIF_DIRECTORY = "SAFSDIFDIRECTORY" Const SAFS_LOGS_DIRECTORY = "SAFSLOGSDIRECTORY" Const SAFS_RUNTIME_REPOSITORY = "SAFSRUNTIMEREPOSITORY" Const SAFS_SYSTEM_USERID = "SAFSSYSTEMUSERID"
(none)
Type DDVariable name As String 'name of the variable value As Variant 'value of the variable End Type
Sub InitSAFSConstants () DESCRIPTION: Store all the deduced constants for the Driver into DDVariables. This includes key directory paths and names, etc... PARAMETERS: (none) ERRORS: none Orig Author: Carl Nagle Orig Date: DEC 15, 2003 History: DEC 15, 2003 Original Release APR 26, 2004 (CANAGL) Added SAFSystemUSERID to precanned variables DEC 07, 2006 (CANAGL) Bypass DDVariableStore if SAFS available
Function DDVGetVariableValue (varname As String, varvalue As Variant) As Integer DESCRIPTION: Locate the variable varname value and return it in the varvalue Variant. If the variable does not exist, we will attempt lookthru to the current Application Map FALLBACK LOOKUP SECTION as set or defaulted in DDGUIUtilties.DDGGetDefaultAppMapSection. Items successfully retrieved via lookthru to the Application Map are NOT set as variables here. They remain as items stored in the Application Map retrieved via the DDGUIUtilities.DDGGetGUIID call. If the variable is still not found, then this call creates it and gives it the default value as may be provided in the varvalue Variant. PARAMETERS: varname Case-insensitive name of the variable to retrieve the value of. varvalue Variant to hold the retrieved value of the variable. This input Variant will not be modified if the variable name does not exist in storage or is not found via lookthru in the current Application Map(if any). Thus, you can preset the Variant to contain a default (non-empty) value for the call. The variable will then be stored with this default (non-empty) value and sqaSuccess will be returned. RETURNS: 0 (sqaSuccess) if the variable name exists and we set the varvalue (or accepted the default value provided). -1 If the variable was not found to exist and could not be defaulted. ERRORS: none Orig Author: Carl Nagle Orig Date: JUL 18, 2000 History: JUL 18, 2000 Original Release MAR 15, 2001 (CANAGL) Added lookthru to the Application Map AUG 03, 2001 (CANAGL) Converted to DDVariableStore.DLL DEC 07, 2006 (CANAGL) Bypass DDVariableStore if SAFS available
Function DDVSetVariableValue (varname As String, varvalue As Variant) As Integer DESCRIPTION: Set a named variable to the given value. If the variable already exists then overwrite the existing value. If not, create it. PARAMETERS: varname Case-insensitive name of the variable to set. varvalue Variant containing the value to assign the variable. RETURNS: 0 (sqaSuccess) if the variable name & value was set. -1 if the varname or varvalue are invalid values (null) ERRORS: none Orig Author: Carl Nagle Orig Date: JUL 18, 2000 History: JUL 18, 2000 Original Release AUG 03, 2001 (CANAGL) Converted to DDVariableStore.DLL JUN 16, 2003 (CANAGL) Corrected return code doc. DEC 07, 2006 (CANAGL) Bypass DDVariableStore if SAFS available
Sub DDVClearAllVariables () DESCRIPTION: Clear out and Reset our DDVariableStore PARAMETERS: none ERRORS: none Orig Author: Carl Nagle Orig Date: JUL 18, 2000 History: JUL 18, 2000 Original Release AUG 03, 2001 (CANAGL) Converted to DDVariableStore.DLL DEC 07, 2006 (CANAGL) Bypass DDVariableStore if SAFS available
Function DDVSubstituteVariables (inputRecord As String, fieldID As Integer, delimiters As String) As String DESCRIPTION: Given an inputRecord, delimiters, and a fieldID into the record to start with; attempt to locate references to stored variables and substitute the values of those variables enclosed in quotes in place of the references (in a copy of the inputRecord). Variable references are identified by a leading caretd (^) immediately followed by the name of the variable. The name of the variable itself cannot contain any whitespace, quotes, additional carets, equality symbols (=), or any field delimiters that might be used during the life of the variable. The routine will successfully ignore variable assignment references (Ex: ^var1 = "some value") Examples of variable references (delimited by commas): ^ID , ^employee.name , ^employee.address1 , ^employee.address2 On exit the above example would now contain the values of the variables: but it will substitute them in place like this: "6422","John Smith","124 Main St.","LidsVille USA" Use StringUtilities.GetTrimmedQuotedField to extract the value of the field from the new record. Note: For runtime optimizations, no error detection is performed on the input parameters. This should be handled prior to calling this routine. PARAMETERS: inputRecord delimited record of fields possibly containing references to variables. This String will not be modified by this routine. A copy will be created, modified, and returned. fieldID the index to begin processing the inputRecord. Normally, we would process from the very beginning, which is field 1. delimiters A String of the delimiters that possibly separates the fields in the inputRecord. Any one character acts like a delimiter. RETURNS: String A copy of the inputRecord with any variable references converted to their actual values. ERRORS: none Orig Author: Carl Nagle Orig Date: JUL 19, 2000 History: JUL 19, 2000 Original Release SEP 29, 2000 (CANAGL) Optimizations
Function DDVExtractVariables (inputRecord As String, fieldID As Integer, delimiters As String) As String DESCRIPTION: Given an inputRecord, delimiters, and a fieldID into the record to start with; attempt to locate variable assignment references and store the variable with its assigned value. Once the assignments are complete replace the assignment field in the record with the value of the assignment enclosed in quotes to preserve an leading or trailing spaces. Variable assignment references are identified by a leading caret (^) immediately followed by the name of the variable, an equal sign (=), and the value to assign to that variable. Whitespace can exist on either side of the equal sign. If the proposed value is NOT another variable reference then the proposed value will be trimmed of leading and trailing whitespace via StringUtilities.GetTrimmedQuotedString. And, yes, a variable can be assigned the value of another variable. The name of the variable itself cannot contain any whitespace, quotes, additional carets, equality symbols (=), or any field delimiters that might be used during the life of the variable. Examples of variable assignment references (delimited by commas): AddEmployee, ^ID=6422, ^employee.name = "John Smith" , ^payID = ^ID On exit the above example would not only store the values of the variables, but it will substitute them in place like this: AddEmployee,"6422","John Smith","6422" Note: For runtime optimizations, no error detection is performed on the input parameters. This should be handled prior to calling this routine. Additionally, if there field values which need to begin with an caret(^) that are not to be considered as variables they should be enclosed in quotes. PARAMETERS: inputRecord delimited record of fields possibly containing references to variables. This String will not be modified by this routine. A copy will be created and modified for return. fieldID the index to begin processing the inputRecord. Normally, we would process from the very beginning, which is field 1. delimiters A String of the delimiters that possibly separates the fields in the inputRecord. Any one character acts like a delimiter. RETURNS: String A copy of the inputRecord with any variable assignments converted to their actual values. ERRORS: none Orig Author: Carl Nagle Orig Date: JUL 19, 2000 History: JUL 19, 2000 Original Release SEP 29, 2000 (CANAGL) Optimizations
Function DDVProcessExpression (expression As String) As String DESCRIPTION: Process the provided expression using our global DDVariableStore. The routine uses StringUtilities.ProcessExpression PARAMETERS: expression the String expression to process. RETURNS: String The results of the expression conversion. ERRORS: none Orig Author: Carl Nagle Orig Date: SEP 28, 2001 History: SEP 28, 2001 Original Release DEC 07, 2006 (CANAGL) Bypass DDVariableStore if SAFS available
Function DDVProcessFieldExpressions (inputRecord As String, fieldID As Integer, delimiters As String) As String DESCRIPTION: Given an inputRecord, delimiters, and a fieldID into the record to start with--attempt to process expressions in fieldID and each subsequent field. The routine uses StringUtilities.ProcessFieldExpressions. PARAMETERS: inputRecord delimited record of fields possibly containing references to variables. This String will not be modified by this routine. A copy will be created and modified for return. fieldID the index to begin processing the inputRecord. Normally, we would process from the very beginning, which is field 1. delimiters A String of the delimiters that possibly separates the fields in the inputRecord. Any one character acts like a delimiter. RETURNS: String A copy of the inputRecord with expressions converted to their actual values. Some fields may not be converted if there are errors with the parameters or syntax. ERRORS: none Orig Author: Carl Nagle Orig Date: SEP 28, 2001 History: SEP 28, 2001 Original Release DEC 07, 2006 (CANAGL) Bypass DDVariableStore if SAFS available
Copyright (C) SAS Institute GNU General Public License: http://www.opensource.org/licenses/gpl-license.php ==============================================================================