<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/discussions/f/rules/21776/remove-the-duplicate-values-from-a-text-rule-input</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85249?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 11:47:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:22ea1362-e418-4dc5-80ff-dbd3af1e34f9</guid><dc:creator>Richard Michaelis</dc:creator><description>&lt;p&gt;i was looking for online documentation :)&amp;nbsp;&lt;br /&gt;I know how to search for specific function at the documentation (appian.com). My question targeted towards fn! functions specifically.&amp;nbsp;we have a list of several functions provided by appian. Are all of them available as fn!&lt;/p&gt;
&lt;p&gt;functions?&lt;/p&gt;
&lt;p&gt;my code would have looked something like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!trimmed: trim(ri!inputString),
  local!split: split(local!trimmed, &amp;quot; &amp;quot;),
  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), &amp;quot; &amp;quot;),
      concat(fv!item, &amp;quot; &amp;quot;)
    )
  ),
  concat(local!result)
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85245?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:39:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6b4584d2-3d7f-4cdf-a064-e6f71f58ff29</guid><dc:creator>AKASH T</dc:creator><description>&lt;p&gt;Works well But the result will be displayed in lower case.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85244?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:36:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d6c21bda-5a5b-4950-8dee-596f70ef173e</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;There are a couple of resources I typically use:&lt;/p&gt;
&lt;p&gt;In the expression designer interface you can access this list as follows:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/15/pastedimage1630406045625v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;There is also online documentation:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.appian.com/suite/help/21.1/Appian_Functions.html"&gt;https://docs.appian.com/suite/help/21.1/Appian_Functions.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;(if you&amp;#39;re not on 21.1 then you can navigate to &lt;a href="https://docs.appian.com/"&gt;https://docs.appian.com/&lt;/a&gt;&amp;nbsp;and then choose your version)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85243?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:33:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0055c69d-7a91-4d26-ad5e-991a6cfef7c6</guid><dc:creator>baji mekala</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;AKASH T,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;can you try this one&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;a!localVariables(&lt;br /&gt; local!string:union(split(lower(&amp;quot;Hello hello Hello there there past pastures&amp;quot;),&amp;quot; &amp;quot;),split(lower(&amp;quot;Hello hello Hello there there past pastures&amp;quot;),&amp;quot; &amp;quot;)),&lt;br /&gt; substitute(tostring(local!string),&amp;quot;;&amp;quot;,&amp;quot; &amp;quot;)&lt;br /&gt;)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85241?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:30:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ff4f6e91-6406-42dc-9979-9df76fa61864</guid><dc:creator>Richard Michaelis</dc:creator><description>&lt;p&gt;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.&amp;nbsp;&lt;br /&gt;Just curious....&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85240?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:26:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:686cc1a5-bed3-4d90-a09d-8dbe30ceffde</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;There maybe more elegant ways, but something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!trimmed: fn!trim(ri!inputString),
  local!split: fn!split(local!trimmed, &amp;quot; &amp;quot;),
  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), &amp;quot; &amp;quot;),
      concat(fv!item, &amp;quot; &amp;quot;)
    )
  ),
  fv!concat(local!result)
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Notes:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;fn!trim() removes all unnecessary spaces (in case you have more than one space between the individual strings)&amp;nbsp;&lt;/li&gt;
&lt;li&gt;fn!split() breaks up the&amp;nbsp;input strings into an array so they can be processed independently&lt;/li&gt;
&lt;li&gt;fn!lower() makes all of the strings into lower case so that, for example, all &amp;quot;Hello&amp;quot; items are the same&lt;/li&gt;
&lt;li&gt;fn!union() removes duplicate strings from the array&lt;/li&gt;
&lt;li&gt;the a!forEach() allows us to treat the very first item in the array differently from the others, so we can use fn!proper() to capitalize the first letter for just the first string. For all items we add single space so that...&lt;/li&gt;
&lt;li&gt;...we can then concatenate all of the items in the array to a single output string&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85239?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:26:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:86f1fc61-88d1-4732-93af-8db797cac834</guid><dc:creator>AKASH T</dc:creator><description>&lt;p&gt;Union will return&amp;nbsp;&lt;br /&gt;&lt;strong&gt;Hello hello there past&amp;nbsp;pastures&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;But the result should be &lt;strong&gt;Hello there past pastures&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85237?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:23:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:049b46ce-96d1-4185-ad70-da48d5471cee</guid><dc:creator>Richard Michaelis</dc:creator><description>&lt;p&gt;good approach. perhaps user lower()&amp;nbsp;or proper() in combination with the split results to avoid &amp;quot;hello&amp;quot; and &amp;quot;Hello&amp;quot; treated as different values.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85236?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:23:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:15b2418d-ae53-4c23-abeb-3494577202bf</guid><dc:creator>Harsha Sharma</dc:creator><description>&lt;p&gt;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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85234?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:18:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7e65be1c-1d03-4baa-8e97-a272356df57f</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;You use split() to turn it into a list and union() to remove duplicates.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85233?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:14:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fb8ac06a-86b9-481f-871b-b92c473902b2</guid><dc:creator>Richard Michaelis</dc:creator><description>&lt;p&gt;in any case there is no &amp;quot;simple&amp;quot; method or function to archive that.&lt;br /&gt;1.) You need to cut it into pieces (word for word)&lt;br /&gt;2.) compare the different values to each other&lt;br /&gt;3.) remove the values you don&amp;#39;t want to have.&lt;br /&gt;&lt;br /&gt;Spontanously I would suggest an expression with extract(), search() perhaps cleanwith()&amp;nbsp;&lt;br /&gt;Sorry no final solution for that issue on hand.&amp;nbsp;&lt;br /&gt;-&amp;gt; &lt;a href="https://docs.appian.com/suite/help/21.3/Appian_Functions.html"&gt;docs.appian.com/.../Appian_Functions.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85231?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:03:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4771e0a6-8fce-4781-85dc-aa9e8e623df1</guid><dc:creator>AKASH T</dc:creator><description>&lt;p&gt;single string&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove the duplicate values from a text rule input?</title><link>https://community.appian.com/thread/85229?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:02:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e6d6ef7e-d66a-4d62-a337-636d69284b9c</guid><dc:creator>Richard Michaelis</dc:creator><description>&lt;p&gt;is that an array of string values or&amp;nbsp;a single string?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>