Skip to main content

Map

This formula allows you to map each value of a list to a different value. For example, the following Map formula executed on the array [1, 2, 3] will result in the array [2, 3, 4]:

{
"type": "map",
"components": {
"type": "list",
"components": [
{
"type": "constant",
"value": 1,
"value_type": "integer"
},
{
"type": "constant",
"value": 2,
"value_type": "integer"
},
{
"type": "constant",
"value": 3,
"value_type": "integer"
},
]
},
"mapper": {
"type": "add",
"components": {
"type": "list",
"components": [
{
"type": "stat",
"stat": "$mapValue"
},
{
"type": "constant",
"value": 1,
"value_type": "integer"
},
]
}
}
}

Returns

array<S>

JSON Format

{
"type": "map",
"components": ...,
"mapper": ...,
"map_value_key": ...
}

RPG Script

This component can be written in RPG Script as:

map(...)

Fields

FieldTypeRequiredDescription
map_value_keyStringOptional parameter that lets you provide a key to use in the mapper formula to access the array's current value in the iteration. e.g: if you are iterating classes, you might want to assign "$class" to the map_value_key, to make your system easier to read. This is also helpful when dealing with nested Map formulas, as it will allow inner Map formulas to access the values of outer filter formulas.