Skip to main content
Question

In Appian, write an expression rule that finds the vowels in each word of the given array.

Input:

{"Apple", "Sky", "Orange", "Fly"}

Expected output:

{
{
word: "Apple",
vowels: {"A","e"}
},
{
word: "Sky",
vowels: {}
},
{
word: "Orange",
vowels: {"O","a","e"}
},
{
word: "Fly",
vowels: {}
}
}

A
Anonymous
May 20, 2026

Answer

Solution – Appian Expression Rule

a!localVariables(
local!words: {"Apple", "Sky", "Orange", "Fly"},
local!vowels: {"a", "e", "i", "o", "u"},

a!forEach(
items: local!words,
expression: a!localVariables(
local!word: fv!item,

a!map(
word: local!word,
vowels: reject(
fn!isnull,
a!forEach(
items: enumerate(len(local!word)) + 1,
expression: a!localVariables(
local!char: mid(local!word, fv!item, 1),

if(
contains(
local!vowels,
lower(local!char)
),
local!char,
null
)
)
)
)
)
)
)
)


How Does It Work?

1. Iterate Through Each Word

The outer a!forEach() processes each word from the input array individually.

For example, when processing "Apple", the current word is stored in local!word.


2. Extract Characters From the Word

We use len(), enumerate(), and mid() to extract each character.

For "Apple":

  1. len("Apple") returns 5.
  2. enumerate(5) + 1 generates {1, 2, 3, 4, 5}.
  3. mid() extracts the characters: {"A", "p", "p", "l", "e"}.


3. Identify Vowels

Each extracted character is converted to lowercase using lower() and checked against the vowel list using contains().

If the character is a vowel, the original character is returned. Otherwise, null is returned.

For "Apple", the intermediate result is:

{"A", null, null, null, "e"}


4. Remove Non-Vowels

The reject(fn!isnull, ...) function removes all null values, leaving only vowels.

{"A", "e"}

Finally, a!map() combines the original word with its extracted vowels.

The same process repeats for every word in the input array.


Practical Example

Consider the input:

{"Apple", "Sky", "Orange", "Fly"}

Apple

  1. Extracted characters: {"A", "p", "p", "l", "e"}
  2. Vowels found: {"A", "e"}

Sky

  1. Extracted characters: {"S", "k", "y"}
  2. Vowels found: {}

Orange

  1. Extracted characters: {"O", "r", "a", "n", "g", "e"}
  2. Vowels found: {"O", "a", "e"}

Fly

  1. Extracted characters: {"F", "l", "y"}
  2. Vowels found: {}


Key Functions Used

Function

Purpose

a!forEach()

Iterates through words and characters

len()

Returns the number of characters in a word

enumerate()

Generates character positions

mid()

Extracts an individual character

lower()

Converts characters to lowercase for comparison

contains()

Checks whether a character is a vowel

reject()

Removes null values

a!map()

Organizes the word and extracted vowels


Additional Test Cases

Input

Expected Vowels

"Banana"

{"a", "a", "a"}

"AEIOU"

{"A", "E", "I", "O", "U"}

"Rhythm"

{}

"Queue"

{"u", "e", "u", "e"}

"Education"

{"E", "u", "a", "i", "o"}

Interview Takeaways

This coding challenge tests your understanding of:

  1. Working with nested a!forEach() loops.
  2. Manipulating strings using Appian expression functions.
  3. Applying conditional logic to filter data.
  4. Handling null values and empty arrays.
  5. Creating structured output using a!map().


Important: The solution preserves duplicate vowels and their original capitalization. For example, "Banana" returns {"a", "a", "a"}, not {"a"}.


For Reusability: Instead of hardcoding local!words, define a rule input named ri!words of type Text Array and use it in the outer a!forEach().

This allows the expression rule to process different word arrays dynamically.

Try it yourself

Change the inputs or the expression and run it to see what it returns.

ri!words=

Independent evaluator: it approximates the Appian expression language and may differ from a real Appian environment. Verify anything that matters. Terms

JuniorExpressions#coding