My requirement is to remove the duplicate values from a rule input of type text. Here is a sample input and output.
Input: Hello hello Hello there there past pastures
Output: Hello there past pastures
Discussion posts and replies are publicly visible
is that an array of string values or a single string?
in any case there is no "simple" method or function to archive that.1.) You need to cut it into pieces (word for word)2.) compare the different values to each other3.) remove the values you don't want to have.Spontanously I would suggest an expression with extract(), search() perhaps cleanwith() Sorry no final solution for that issue on hand. -> docs.appian.com/.../Appian_Functions.html
You use split() to turn it into a list and union() to remove duplicates.
you can first do split() on spaces and then take union() of the split array to filter out repeated strings. Lastly concat the result with spaces in between.
good approach. perhaps user lower() or proper() in combination with the split results to avoid "hello" and "Hello" treated as different values.
Union will return Hello hello there past pastures
But the result should be Hello there past pastures
There maybe more elegant ways, but something like this:
local!split: fn!split(local!trimmed, " "),
local!union: fn!union(local!lower, local!lower),
concat(fn!proper(fv!item), " "),
concat(fv!item, " ")
hi stewart, is there an guide for fn! functions somewhere ? not all functions are available as fn! but is there any simple rule like all functions without a! or a page to explain them. Just curious....
Hi AKASH T,
can you try this one
a!localVariables( local!string:union(split(lower("Hello hello Hello there there past pastures")," "),split(lower("Hello hello Hello there there past pastures")," ")), substitute(tostring(local!string),";"," "))
© 2023 Appian. All rights reserved.