OFFSET( ) function
Returns the value of a field with the starting position offset by a specified number of bytes.
Syntax
OFFSET(field, number_of_bytes)
Parameters
Name | Type | Description |
---|---|---|
field |
character numeric datetime |
A field name. |
number_of_bytes | numeric | Any positive numeric expression. |
Output
The return value is the same data type as the input field parameter.
Examples
Basic examples
If you have a field called "Number" that contains the value "1234567890" and you define an overlapping field called "Offset_Number" that has a starting position of 1, a length of 3, and no decimals places, you can use the OFFSET( ) function to shift the numbers in the field.
Returns 123:
OFFSET(Offset_Number,0)
Returns 234:
OFFSET(Offset_Number,1)
Returns 789:
OFFSET(Offset_Number,6)
Remarks
You can use this function to temporarily offset the starting position of a field. This is useful when you are processing data where the field starting position is variable.
If you use the OFFSET( ) function with conditional computed fields, any fields referenced in the IF test will also be offset.