This article will cover the syntax of the ‘map’ regular script statement

The map statement is used with a mapping table. It’s a way to map specific field values to the values in the mapping table.

Statement syntax

Map fieldlist Using  mapname;

FieldlistA comma separated list of fields to be mapped. Note that only subsequently loaded fields will be mapped.
MapnameThe name of the mapping table previously loaded.

Example

A map is created to map the status of each sale against the status enums that are available in the database. 

SALE_STATUS:
MAPPING LOAD * INLINE [
  SaleStatusEnum, Status 
  1, Ordered
  2, Paid
  3, Dispatched
  4, Delivered
];
Map Status using SALE_STATUS;
SALES:
LOAD * INLINE [
    SalesID, Status
    SLS0001, 4
    SLS0002, 2
    SLS0003, 1
];

Result

The ‘SALES’ table is loaded into the app. The field ‘Status’ has the status descriptions rather than the original enums.