Rounding and Formatting Results
Whenever a results for a test is made available for the inclusion on a report (especially a certificate report of analytical results) there is a specific set of requirements as to how the result must be rounded and formatted so that it is presented in a format and style that reflects the scientific and industrial requirements on the presentation of results derived from analytical tests.
The Rounding Method Type and the Data Type of a pre-formatted final result is rounded if the Data Type is Numeric or Boolean. It is formatted according to Data Type, which determines the rounding and formatting that is required to produce the Formatted Final Value. The pre-formatted final result can be a Numeric Final Value, Text Value, (including the holding of a Boolean result) or Date Value (including both Date and DateTime),
Result Types
The scheme version analyte's Data Type denotes the type of result that is expected for the analyte. This can be:
- Numeric Only
- Numeric
- Text
- Boolean
- Date
- DateTime
- Document
- Image.
When a result is received, the sample scheme analyte's Current Data Type is set accordingly, and the pre-rounded, pre-formatted value is located in one of the following fields in the sample scheme analyte (SSA) table:
| CURRENT_DATA_TYPE | Unformatted results storage in SSA table | Unformatted data type, as per CURRENT_DATA_TYPE |
|---|---|---|
|
Numeric |
NUMERIC_FINAL_VALUE |
NUMBER/FLOAT |
|
Text |
TEXT_VALUE |
VARCHAR(200) |
|
Boolean |
BOOLEAN_VALUE |
CHAR(1) |
|
Date |
DATE_TIME_VALUE |
TIMESTAMP(6) WITH TIME ZONE |
|
DateTime |
SSA.DATE_TIME_VALUE |
TIMESTAMP(6) WITH TIME ZONE |
|
Document |
DOCUMENT_FILE_ID |
CHAR(32), containing a link to the EFS ID |
|
Image |
IMAGE_FILE_ID |
CHAR(32), containing a link to the EFS ID |
Rounding a Result according to its Data Type
If the sample scheme analyte's Current Data Type is Numeric, Text, Boolean, Date or DateTime, the value of the Unformatted Final Result is used to generate the value of the sample scheme analyte's Formatted Final Result.
The Formatted Final Result is stored in formattedFinalValue as TextArea (200) in the report request sample scheme analyte.
Document and image results cannot be rounded nor formatted.
Rounding a Result
The scheme version analyte's Rounding Method Type denotes the type of rounding that must be applied to a result of a given data type.
|
Analytical Result Type |
|||||
|---|---|---|---|---|---|
| Rounding Method Type |
Numeric |
Text |
Boolean |
Date |
DateTime |
|
None |
Yes |
Yes |
Yes |
Yes |
Yes |
|
Table |
Yes |
No |
Yes |
No |
No |
|
Mask |
Yes |
No |
Yes |
Yes |
Yes |
|
Script |
Yes |
Yes |
Yes |
Yes |
Yes |
The Formatted Final Value is either a rounded result, a hard-coded report string that represents a Workflow Status of Listed No Result, Insufficient Sample, Not Analysed or No Result) where there is no result, or left empty.
Rounding Positive Numbers versus Rounding Negative Numbers
Where a value is less than the midway point, then the rounded value is the floor. Where a value is greater than the midway point, then the rounded value is the ceiling. Where a value is exactly at the midway point, then ISO rounding is applied if it is configured to do be so.
When rounding negative numbers (normal or ISO rounding), then the absolute of the value is rounded, then the negative sign is reapplied after rounding, except that the floor and the ceiling are reversed.
For example, if the picture is #.# and increment is 1 and the value to round is:
- 1.35, then the floor is 1.3 and the ceiling is 1.4, and 1.35 is the midway point. Therefore, 1.4 is the rounded value.
- -1.35, then the floor is -1.4 and the ceiling is -1.3, and -1.35 is the midway point. Therefore, 1.35 is rounded to 1.4 and the negative sign is reapplied so that -1.4 is the rounded value.
Persisting the Formatted Final Value
Although the report request sample scheme analyte's Formatted Final Value is calculated and rendered as a formatted string in the reportable result set so that it can be placed on a certificate report, it is only persisted to that field and to the sample scheme analyte's Formatted Final Value in the following circumstances.
| Report Request's Report Type | Report's Status Type | Persisted to the Report Request Sample Scheme Analyte table? | Persisted to the Sample Scheme Analyte table? |
|---|---|---|---|
|
Paperwork or Labels |
N/A (not calculated) |
No |
No |
|
Certificate |
Internal |
No |
No |
|
Certificate |
Preliminary or Final |
Yes, to formattedFinalValue when the data type is Numeric, Text, Boolean, Date or DateTime |
Yes, to formattedFinalValue where the Current Data Type is Numeric, Text, Boolean, Date or DateTime and the TRANSFER_RRSSA_REPORT_DATA_TO_SSA application preference is checked. No if the TRANSFER_RRSSA_REPORT_DATA_TO_SSA application preference is not defined, or is defined and cleared. |
If a certificate report is generated with a Report Status Type of Final and the TRANSFER_RRSSA_REPORT_DATA_TO_SSA application preference is checked, when a result is rounded, then sample scheme analyte's Formatted Final Value, Rep Lower Det Limit, Rep Upper Det Limit and Uncertainty Value are set to those on the report request sample scheme analyte.
- Generating Reports from Report Requests
- Setting how Results are Presented in the Reportable Result Set
- Maintaining Units
- Maintaining Rounding Tables
- Maintaining Schemes
- Maintaining Scheme Version Analytes
- Maintaining Range Tables
- Maintaining System Table Codes
- Calculating Uncertainty
- Using ISO Rounding
