ReplaceWithExtraData

Description:

ReplaceWithExtraData method looks up the value of the current field in the table specified in the parameter, and then replaces the value of the current field with the extra data from the table. If the table entry does not have extra data, zero is returned. Usually used in connection with the STORE keyword.

For example, assume a protocol has a field where the value maps to another value indicating a size. The method allows you to put the actual size in the field, where it can be used for other purposes.

Parameters:

[Required]

Table

"Which table"


Example:

In this example, storing the retrieved value under a different field name allows you to display the correct string from the table, and still use the correct value for the "next_field" field.

TABLE sizes

{1 "1 Bit" "1 Bit" 1}

{2 "4 Bits" "4 Bits" 4}

{3 "1 Byte" "1 Byte" 8}

ENDTABLE

FIELD size_lookup (Fixed 1 Byte) (Table sizes) "Next Field Size" STORE field_size RETRIEVE (ReplaceWithExtraData sizes)

FIELD next_field (FromField Bits field_size) (Decimal) "Number"