Appian a!map()
Build a record with named fields. The shape almost all real Appian data arrives in, and the one thing you must not compare with an equals sign.
Official Appian documentationThe shape
a!map() builds a record: named fields with values, in one value you can pass around.
a!map(name: "Ann", age: 30)
The names are yours to choose. Values can be anything — a number, text, a list, or another map.
Reading a field back
With index(), exactly as you would read a position out of a list:
index(a!map(name: "Ann"), "name", "") → "Ann"
The third argument still matters: a field that is not there gives you the default rather than a failure, which is what makes records from real data safe to read.
a!keys() tells you which fields a record actually has.
Records do not change — they are replaced
a!update() hands back a new record with one field different. The original is untouched:
a!update(a!map(name: "Ann", age: 30), "age", 31)
If you want the change, you have to use what comes back. Calling a!update() and then reading the original is the mistake this catches, and it fails quietly because the original is still perfectly valid — just unchanged.
Naming a field that does not exist yet adds it, so the same function both edits and extends.
A list of records is the normal shape of data
Query results, rows, anything with more than one column arrives as a list of maps. Everything the earlier lessons taught applies to it:
index(people, "name", "")— that field from every record, no loopwhere(scores >= 60)— the positions that matcha!forEach()— when you need to build a whole new record per item
The trap: do not compare whole records
= does not do what you expect on maps. Two records with identical fields are reported as not equal:
a!map(name: "Ann") = a!map(name: "Ann") → false
Compare the fields you care about instead — index(a, "name", "") = index(b, "name", "") — rather than the records themselves.
Try it
Run each one and read what comes back before moving on.
1Build a record with two fields.
a!map(name: "Ann", age: 30)
2Read one field back out.
index(a!map(name: "Ann", age: 30), "name", "")
3Ask a record which fields it has.
a!keys(a!map(name: "Ann", age: 30))
1Change a field and look at what comes back.
a!update(a!map(name: "Ann", age: 30), "age", 31)
2Now update a record, then read the original.
a!localVariables(local!person: a!map(age: 30), local!older: a!update(local!person, "age", 31), index(local!person, "age", 0))
Compare two records that look identical.
a!map(name: "Ann") = a!map(name: "Ann")
Independent evaluator — approximates the Appian expression language and may differ from a real Appian environment. Verify anything that matters. Terms
Exercises
0 of 5 cleared- 1a!map(): build a record from separate valuesEasy
- 2a!map(): list the fields a record hasEasy
- 3a!map(): apply a profile edit, protecting read-only fieldsMedium
- 4a!map(): pair two lists into recordsMedium
- 5a!map(): merge a form into a customer recordHard