Get distinct flatten array


#1

How to get merged actions base on role from below doc

{
“type”: “role”,
“roles”: [
{
“role”: “Key Manager”,
“actions”: [
“ANK”
]
},
{
“role”: “Client Manager”,
“actions”: [
“ANC”
]
}
]
}

Input is array of Role [“key Manager”,“Client Manager”]
Output :[“ANC”,ANK]


#2
  ARRAY_DISTINCT(
          ARRAY_FLATTEN(ARRAY v.actions 
                        FOR v IN roles 
                        WHEN v.`role` IN  ["key Manager","Client Manager"] 
                        END, 1)
       )