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: {} }}
In Appian, write an expression rule that finds the vowels in each word of the given array.
Input:
Expected output:
Answer
Solution – Appian Expression Rule
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":
len("Apple")returns5.enumerate(5) + 1generates{1, 2, 3, 4, 5}.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:
4. Remove Non-Vowels
The reject(fn!isnull, ...) function removes all null values, leaving only vowels.
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
- Extracted characters:
{"A", "p", "p", "l", "e"} - Vowels found:
{"A", "e"}
Sky
- Extracted characters:
{"S", "k", "y"} - Vowels found:
{}
Orange
- Extracted characters:
{"O", "r", "a", "n", "g", "e"} - Vowels found:
{"O", "a", "e"}
Fly
- Extracted characters:
{"F", "l", "y"} - Vowels found:
{}
Key Functions Used
Function | Purpose |
|---|---|
| Iterates through words and characters |
| Returns the number of characters in a word |
| Generates character positions |
| Extracts an individual character |
| Converts characters to lowercase for comparison |
| Checks whether a character is a vowel |
| Removes null values |
| Organizes the word and extracted vowels |
Additional Test Cases
Input | Expected Vowels |
|---|---|
|
|
|
|
|
|
|
|
|
|
Interview Takeaways
This coding challenge tests your understanding of:
- Working with nested
a!forEach()loops. - Manipulating strings using Appian expression functions.
- Applying conditional logic to filter data.
- Handling null values and empty arrays.
- 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.
Independent evaluator: it approximates the Appian expression language and may differ from a real Appian environment. Verify anything that matters. Terms