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
There maybe more elegant ways, but something like this:
a!localVariables( local!trimmed: fn!trim(ri!inputString), local!split: fn!split(local!trimmed, " "), local!lower: fn!lower(local!split), local!union: fn!union(local!lower, local!lower), local!result: a!forEach( items: local!union, expression: if( fv!isFirst, concat(fn!proper(fv!item), " "), concat(fv!item, " ") ) ), fv!concat(local!result) )
Notes:
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),";"," "))
There are a couple of resources I typically use:
In the expression designer interface you can access this list as follows:
There is also online documentation:
https://docs.appian.com/suite/help/21.1/Appian_Functions.html
(if you're not on 21.1 then you can navigate to https://docs.appian.com/ and then choose your version)
i was looking for online documentation :) I know how to search for specific function at the documentation (appian.com). My question targeted towards fn! functions specifically. we have a list of several functions provided by appian. Are all of them available as fn!
functions?
my code would have looked something like this:
a!localVariables( local!trimmed: trim(ri!inputString), local!split: split(local!trimmed, " "), local!lower: lower(local!split), local!union: union(local!lower, local!lower), local!result: a!forEach( items: local!union, expression: if( fv!isFirst, concat(proper(fv!item), " "), concat(fv!item, " ") ) ), concat(local!result) )