ValidateConvertMiniMaxTarget

Validate/Convert Minimum, Maximum, Target

Major Business Rule

Object Name: B3700010

Parent DLL: CMFG

Location: Client/Server

Language: C

Functional Description

Purpose


The purpose of this function will be to resolve two problems that exist when dealing with minimum, 

maximum and target fields in Quality Management.  

1.  The fields used to store these values are defined alpha-numerically within the database.  The 

minimum, maximum and target fields can be defined both alpha-numerically and numerically in Quality 

Management.  

2.  In OneWorld, the only way to override the number of decimals for a given field is at the 

application level.  In Quality Management, the number of decimals does not vary per application but varies per 

test.  


Setup Notes and Prerequisites


Prior to executing this function the calling program must fetch the Test Master record, F3701 and/or 

the Quality Preference record, F40318.  The Preference record may hold values that override the values 

at the Test Master level.  Which file should be used will be determined prior to calling this 

business function.  B3700010 will have access to a  data structure, D3700010.  This will be used to hold all 

the pertinent data as well as the value to be converted or edited, two positions for return 

alpha-numeric and return numeric, a flag to indicate whether the value should be just scrubbed for display, 

scrubbed for the file or edited and an error message.



Special Logic


The program must be able to pass back a number that can contain as many as 9 decimal positions in the 

Return Math Numeric Value.  



Technical Specification


When the value passed in is numeric:

1. Display - Decimal placement.  The function will position the decimal    as it should appear to 
the user and pass back an alpha-numeric field    that will display on the screen.

2. Edit - Numeric value.  The function will also pass back the numeric    equivalent of the same 

value.  This number will be used by the calling    application to edit minimum, maximum and target.

3. Store - Decimal removal, zero fill, round out unnecessary digits.     When numeric values are 

stored in alpha-numeric fields, the decimal    point is removed and the numbers are filled with 

zeroes for each    decimal position that is not used.  Also, if additional digits past    the decimals 

number requested are passed in, those digits should    removed and rounded up if the digit closest 

to the requested number of    digits is 5 or greater and rounded down if the digit closest to the   

 requested number is less than 5.  


For example, if the number input by the user is 30 and display decimals is 4, 300000 is stored 
in the database. (The number 30 with 4 additional zeroes to the right.)   If the number input is 

40.56 and display decimals was still 4, 405600 is stored.  This is done so that when the number 

is retrieved from the database and scrubbed for display with 4 decimal positions it will appear 

as the user expects 40.56.  The final example is for passed in values with a number of digits 

greater than the requested number.  If .326666 is passed in, and four decimals are requested, 

3267 should be the store value.   


When the value passed in is alpha-numeric:

1. Display - Since minimum, maximum and target are all alpha-numeric within the database, the 
function will not have to handle the display of an alpha-numeric value.  One World Tools will handle 

this. 

2.Edit - There are two parts to editing an alpha-numeric value.  

A.The function should edit against a UDC table to determine if the  value input by 
the user is valid.  Every alpha-numeric test that  has a UDC table should have all possible 

minimum, maximum and  target values defined in the UDC table.  Every alpha-numeric test 

does not have to have a UDC table.  If a table is not provided by  the user then by definition, 

the value does not have to be edited.

B.The function should pass back the numeric equivalent of the alpha- numeric 

value that is retrieved from the UDC table.

3.Store - The function will not have to handle the scrub of the alpha-numeric value for saving in 
the database.  One World Tools will handle this.



Data Structure

D3700010 - Validate/Convert Minimum, Maximum, Target

Data Item Description           I/ORequiredNotes

EV01                       Call Type                               I               Yes                         One byte field used to indicate the functions that should be processed:                  

                                                                                                                                                                                          

                                                                                                                                1=Scrub for display; 2=Edit; 3=Scrub for database; 4=Process all.


EV02               Data origin                IYes                One byte field used to indicate where the data passed in originated: 

                                                                                                                                1=Database; 2=Display.


NUMT               Numeric 1/0                IYes                1 = numeric, 0 = alphanumeric.


CDEC               Number of DecimalsINo                Ignore if NUMT equals '0'.   If NUMT equals '1' and CDEC is blank, assume 

zero 

                                                                                                                                decimals.


SY               System Code               INo                Ignore if NUMT equals '1'.   If NUMT equals '0' it is o.k. if SY is blank.  If SY is 

filled, 

                                                                                                                                DS20 must exist in the UDC table passed in to the function. (SY/RT)


RT               User Defined Code              INo                Ignore if NUMT equals '1'.   If NUMT equals '0' it is o.k. if RT is blank. If RT is 

filled, 

                                                                                                                                DS20 must exist in the UDC table passed in to the function. (SY/RT)


DS20              String Received              I/OYes                Will hold the value to be scrubbed for display, scrubbed for the database or 

edited.  If 

                              /Returned Value                                                                     the value is blank, assume you can exit and stop processing.  This received 

value will 

                                                                                                                                be replaced by the return value for display.


MATH01             Math Numeric                      OYes                Will hold the numeric equivalent for the value passed in.  Both numeric and 

alpha-

                              Return Value                                                                           numeric values will have numeric equivalents.


DS20                    String Returned Value         OYes                Will hold the alpha-numeric value to be saved to the database. 

                             Datebase


EV01                    Suppress Error Message     I Yes                Will hold a one byte flag indicating if error message should be suppressed or 

not.


DTAI             Error Message ID             OYes                Will hold the error message while performing the edit.


Parameter NameData ItemData TypeReq/OptI/O/Both
cCallTypeEV01charOPTNONE

An option that specifies the type of processing for an event.

cNumericFlagNUMTcharOPTNONE

Determines whether a test result value will be numeric or alphanumeric. Valid values are:    1   Indicates that the result value is numeric and 
should be right justified.    0   Indicates that the result value is alphanumeric and should be left justified. Tests that are using alphanumeric result 
values can have User Defined Code tables setup that contain alpha to numeric translations. The purpose of these tables is to supply result 
evaluations with a way of determining whether a result is within the range of the minimum and maximum values.

cDecimalNumCDECcharOPTNONE

A value that designates the number of decimals in the currency, amount, or quantity fields the system displays. For example, U.S. Dollars 
would be 2  decimals, Japanese Yen would be no decimals, and Cameroon Francs would be 3  decimals.

szSystemCodeSYcharOPTNONE

A user defined code (98/SY) that identifies a system. Valid values include: 01 Address Book 03B Accounts Receivable 04 Accounts 
Payable 09 General Accounting 11 Multicurrency

szRecordTypeCodeRTcharOPTNONE

A code that identifies the table that contains user defined codes. The table is also referred to as a UDC type.

mnNumericValueMATH01MATH_NUMERICOPTNONE

- - - Good Performance Low Value. 

szErrorMessageIDDTAIcharOPTNONE

A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

cSuppressErrorMessageSUPPScharOPTNONE

A flag indicating whether or not runtime error messaging will occur when an error message is issued from a business function.        0 = allow 
runtime error message handling.        1 = suppress runtime error message handling.

cDataOriginEV02charOPTNONE

An option that specifies the type of processing for an event.

szStringValueAMINcharOPTNONE

The lowest value for a passing test result.

szStoreStringValueAMINcharOPTNONE

The lowest value for a passing test result.

mnCodeLengthMATH01MATH_NUMERICOPTNONE

- - - Good Performance Low Value. 

Related Functions

None

Related Tables

F0004 User Defined Code Types
F0005 User Defined Codes