How to: |
The OVRLAY function overlays a base character string with a substring. The function enables you to edit part of an alphanumeric field without replacing the entire field.
OVRLAY(source_string, length, substring, sublen, position, output)
where:
Alphanumeric
Is the base character string.
Integer
Is the number of characters in source_string and output. If this argument is less than or equal to 0, unpredictable results occur.
Alphanumeric
Is the substring that will overlay source_string.
Integer
Is the number of characters in substring. If this argument is less than or equal to 0, the function returns spaces.
Integer
Is the position in source_string at which the overlay begins. If this argument is less than or equal to 0, the function returns spaces. If this argument is larger than stringlen, the function returns the source string.
Alphanumeric
Note that if the overlaid string is longer than the output field, the string is truncated to fit the field.
OVRLAY replaces the last three characters of EMP_ID with CURR_JOBCODE to create a new identification code and stores the result in a column with the format A9:
OVRLAY(EMP_ID, 9, CURR_JOBCODE, 3, 7, 'A9')
For EMP_ID of 326179357 with CURR_JOBCODE of B04, the result is 26179B04.
For EMP_ID of 818692173 with CURR_JOBCODE of A17, the result is 818692A17.
iWay Software |