Question

Expression based hands on a) Given 4 dictionaries of the students data with id, name and city, Asked me to remove the students which belongs to city Pune b) Update dict data, Change city name Mumbai to city name Bangalore


Sample Data: local!students: { a!map(id: 1, name: "John", city: "Pune"), a!map(id: 2, name: "Sam", city: "Mumbai"), a!map(id: 3, name: "Ravi", city: "Pune"), a!map(id: 4, name: "Anu", city: "Delhi") }
A
Anonymous
March 17, 2026

Answer

a) Solution :

a!localVariables(
local!students: {
a!map(id: 1, name: "John", city: "Pune"),
a!map(id: 2, name: "Sam", city: "Mumbai"),
a!map(id: 3, name: "Ravi", city: "Pune"),
a!map(id: 4, name: "Anu", city: "Delhi")
},
remove(
local!students,
wherecontains("Pune", index(local!students, "city", ""))
)
)

Output :

1773747108371-m2gdbkwk9rs.png












Explanation :

This expression defines a list of students using a!localVariables, then removes all students whose city is "Pune". It first uses index() to extract all city values from the student list, resulting in something like {"Pune", "Mumbai", "Pune", "Delhi"}. Then wherecontains() finds the positions where "Pune" appears (positions 1 and 3). Finally, remove() deletes the students at those positions from the original list. As a result, only the students from Mumbai and Delhi remain.


b) Solution:

a!localVariables(
local!students: {
a!map(id: 1, name: "John", city: "Pune"),
a!map(id: 2, name: "Sam", city: "Mumbai"),
a!map(id: 3, name: "Ravi", city: "Pune"),
a!map(id: 4, name: "Anu", city: "Delhi")
},
a!forEach(
items: local!students,
expression: if(
fv!item.city = "Mumbai",
a!update(
data: fv!item,
index: "city",
value: "Bangalore"
),
fv!item
)
)
)

Output:

1773747108373-t49zg2gmqq.jpeg
















Explanation :

This expression defines a list of students and then loops through each student using a!forEach. For every student, it checks if the city is "Mumbai". If the condition is true, it uses a!update() to change the city value to "Bangalore"; otherwise, it keeps the student data unchanged. As a result, only the student(s) from Mumbai will have their city updated to Bangalore, while all others remain the same.

JuniorExpressions#coding
Loading comments...
Expression based hands on a) Given 4 dictionaries of the stu... — Expressions Appian Interview Question | Appian Interview Questions - AppianVerse