Copy Field Operations

Copy field operations copy one field value to a different field.

The copy_field operation copies a source field to a destination field. The fields can be different data types. A field must be one of the following data types:
  • DECIMAL
  • INT8
  • INT16
  • INT32
  • INT64
  • UINT8
  • UINT16
  • UINT32
  • UINT64
For example, if the "from" field is a Decimal data type and the value is -128, then the "to" field results are:
FieldInt8      INT8   0 0 0 1 -128
FieldInt16     INT16  0 0 0 1 -128
FieldInt32     INT32  0 0 0 1 -128
FieldInt64     INT64  0 0 0 1 -128
FieldUInt8     UINT8  0 0 0 1 0
FieldUInt16    UINT16 0 0 0 1 0
FieldUInt32    UINT32 0 0 0 1 0
FieldUInt64    UINT64 0 0 0 1 0
If the "from" field is a Decimal data type and the value is 256, then the "to" field results are:
FieldInt8 INT8 0 0 0 1 127
FieldInt16 INT16 0 0 0 1 256
FieldInt32 INT32 0 0 0 1 256
FieldInt64 INT64 0 0 0 1 256
FieldUInt8 UINT8 0 0 0 1 255
FieldUInt16 UINT16 0 0 0 1 256
FieldUInt32 UINT32 0 0 0 1 256
FieldUInt64 UINT64 0 0 0 1 256
If a value exceeds the maximum value that can be stored in the field, the maximum value of that field's data type is used. If a value is smaller than the minimum value that can be stored in the field, the minimum value of that field's data type is used. For example, if you try to copy an INT64 value of 12,345 to an INT8 field, the resulting INT8 field's value will be 127. The minimum and maximum values that are used for each type are:
Data Type       Minimum value        Maximum Value
INT8            -128                 127
INT16           -32768               32767
INT32           -2147483648          2147483647
INT64           -9223372036854775808 9223372036854775807
UINT8            0                   255
UINT16           0                   65535
UINT32           0                   4294967295
UINT64           0                   18446744073709551615

For an example of the copy_field selective update configuration see the discussion about selective update examples.

Working with Scalars

This table lists the scalar element selectors you can use when working with sequences of scalars.
Table 1. Scalar Selectors
Selector Description
selected_scalar_element Use the selected element in a scalar sequence. When processing a sequence of scalars, if the sequence element in a selection key detects a match and the action value is select, the selected_scalar_element variable is changed to point to the data in the matched sequence element. The selector that is changed is determined by the action value.
prev_selected_scalar_element Use the previous selected_scalar_element. The prev_selected_scalar_element changes every time the selected_scalar_element value is changed and contains the previous value of the selected_scalar_element.
saved_scalar_element Use the last saved MDC. When processing a sequence of scalars, if the sequence element in a selection key detects a match and the action value is save, the saved_scalar_element variable is changed to point to the data in the matched sequence element. The selector that is changed is determined by the "action" value.

For more information about action values, see the discussion about selection keys in MATRIXX Integration.

The scalar element selectors can be used only when answering the following questions:
  • ConcatField:What is the source field\'s name?
  • CopyField:What is the source field\'s name?

The result of a successful match after all of the selection key sections have been processed is a collection of MDCs and scalar elements (the SelectorArray). Each MDC and scalar element in the SelectorArray may be referenced by using one of the selectors.

Process a List using selected_scalar_element

The following example processes a list of uint32s using the selected_scalar_element selector. The result is copied to ResultUInt32.
SelectiveUpdate:DiameterGateway:Input:Element 1011201:Enter an optional description of what this element is doing?Process a list of uint32s using selected_scalar_element, result is copied to ResultUInt32. 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:What is the container's name?TestListOfFieldType 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:What are the selection key IDs?1 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:SelectionKey 1:What method do you want to perform?equal 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:SelectionKey 1:What is the sequence's name?main:FieldUInt32List 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:SelectionKey 1:What is the field's name? 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:SelectionKey 1:What is the field value?120 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:SelectionKey 1:What is the field mask in hex? 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:SelectionKey 1:What action do you want to take on a match?select 
# 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:How many operations do you want to enter?1 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:Operation 1:What operation do you want to perform?copy_field 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:Operation 1:CopyField:What is the destination field's name?main:ResultUInt32 
SelectiveUpdate:DiameterGateway:Input:Element 1011201:Operation 1:CopyField:What is the source field's name?selected_scalar_element