Skip to main content
Skip table of contents

Using Offset and Length

Offset and Length are generally used to map just a portion of the Source code into the Target field. Offset provides the beginning character position within the Source code, and length is the total number of characters that should be copied.

These values only apply to the following migration types: Copy Code, Map Code, Copy Description (1, 2, and 3). They are ignored for other migration types.

So for example, if the value in the Source category field is "ABCDEF":

Offset

Length

Result

1

4

ABCD

3

3

CDE

5

5

EF

0

6

ABCDEF

An Offset of 0 or empty are treated the same as an Offset of 1, in that they start at the beginning of the code.

If the Length is 0 or empty, the entire value to the end of the code is used. Likewise, if the Length is longer than the number of characters in the Source code, the entire value to the end of the code is used.

Using the Offset to Get a Parent Code

It is also possible to use the Offset to get the value of a parent code; that is, a value that is one or more levels higher in the code hierarchy than the code that is entered in the Source field. This is done by entering a negative number as the offset.

For example, assume the following portion of a four-level code hierarchy:

  • Consumer Products

    • Electronics

      • Televisions

        • TV65inch

        • TV55inch

        • TV48inch

      • DVD Players

        • DVDsingledisc

        • DVDmultidisc

  • If the offset is -1 and the user enters a code of "TV55inch," the parent code of "Televisions" would be the migrated value.

  • If the offset is -1 and the user enters a code of "DVDmultidisc," the parent code of "DVD Players" would be the migrated value.

  • If the offset was -2, entering either "DVDmultidisc" or "TV55inch" would result in the parent code of "Electronics" being the migrated value.

If the offset is greater than the number of levels in the hierarchy, an error may occur, the consequences of which are not defined. This is considered to be a configuration error.

The Length still applies to this type of migration; however, the offset within the parent code is always assumed to be 1.

Using Offset to migrate a parent code applies to any of the standard migration types. For example, if you have a "Copy Description2" migration, it could migrate the first 5 characters of the parent code's description2.

Offset and Length for a Map Code Migration

The Offset and Length affect the Map Code migration type in a slightly different manner. This depends on the Category Type of the Source category.

Non-DateTime Category Types

Instead of migrating the partial code determined by the offset and length, it instead uses that value to look up the target code in the map table.

If no matching entry is found for the specified substring, no migration is performed, and no error message occurs. The Map Code type is therefore treated as an 'optional' migration, in that sometimes it may not occur if there is no defined map. Also, when the migration is skipped, any preexisting value in the target field remains unchanged.

DateTime Category Types

This applies only if the Category Type is DateTime or System DateTime.

The Hour (00-24) is extracted from the date value.

It finds the first code map row where the Source code is less than or equal to that hour. It assumes that all of the "Source" codes are defined in the format 00, 01, ..., 24. You do not need to define each possible value. If no exact match is found, it takes the value with the lowest hour.

It then migrates the target code related to that code.

The point of this is to give you the ability to codify a time of day (for example, Breakfast/Lunch/Dinner and Shift1/Shift2/Shift3), based on the DateTime entered in the Source field.

For example, a restaurant business may choose to create the following code mappings:

Source

Target

00

closed

06

breakfast

11

lunch

16

dinner

23

closed

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.