Automatic conversions

The assignment statement offers several implicit conversions.

Converting FIELDSETs to MAPs

FIELDSET variables and MAP TEXT variables can be assigned to each other. All keys in the MAP TEXT that match the rules for Field Set Field names are accessible in the FIELDSET variable. Keys that are not valid names are included into the FIELDSET, but cannot be accessed directly in expressions.

An example is provided here.

MAP TEXT map
ASSIGN map["ValidField"] := "Data"
ASSIGN map["Invalid Field"] := "Cannot access"

FIELDSET Set
ASSIGN Set := map

#
Set: @(Set.ValidField)
#
MAP TEXT other_map
ASSIGN other_map := Set
#
Map: @(other_map["ValidField"])
Map: @(other_map["Invalid Field"])
#

This example produces the following result.

Set: Data
Map: Data
Map: Cannot access

Merging FIELDSETs

The +:= assignment can be used with FIELDSET variables to merge fields from a FIELDSET into another FIELDSET.

ASSIGN Dest +:= Override

This example adds all Fields from the Override Field Set into the Dest Field Set, leaving the fields in Dest that do not overlap with the Override Field Set intact.