How to compare letters of a single word in Appian:
Suppose,
We have to compare letters of word "Apple". The output should be:
1. Number of unique characters in word. In case of "Apple", it should be 4
2. Could of similar characters. Ex: In case of "Apple", A=1,p=2,l=1,e=1
Please provide code for this.
Discussion posts and replies are publicly visible
First, my favorite method of breaking a text into an array of texts: char(code(local!text))
Then, remove duplicate values with union, then grab the length().
local!splitText: char(code(local!text)),
length(union(local!splitText, local!splitText))
To do the second one, you need to have (or make) a split alphabet. Then a!forEach:
a!forEach(
items: local!splitAlphabet,
expression: fv!item & wherecontains(fv!item, local!splitText)
That's how I'd do it, or at least how I'd start.
Thank you