<?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>Expression rule</title><link>https://community.appian.com/discussions/f/rules/37263/expression-rule</link><description>How to write a rule which takes two input a char and an integer, ruleInput: (A,2) Output: (A1;A2) 
 anyone can give me the answer</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/139470?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2024 20:50:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a120ee92-acbd-422d-8287-79e73776374e</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Less lazy reply:&lt;/p&gt;
&lt;p&gt;let&amp;#39;s pretend the rule input is actually 2 inputs, a character and a &amp;quot;times repeated&amp;quot;.&amp;nbsp; I don&amp;#39;t feel like writing a parser to accept a comma-separated value when that may have just been OP overly abbreviating what their input is going to be.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!forEach(
  enumerate(ri!repeats),
  ri!character &amp;amp; fv!index
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For &amp;quot;A&amp;quot; and 2, that gives us basically their prescribed output:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/15/pastedimage1723495775097v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;For &amp;quot;C&amp;quot; and &amp;quot;11&amp;quot;, it performs more of the same:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/15/pastedimage1723495828828v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/139469?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2024 20:45:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:950cc1a5-4e47-46c1-b315-bf0b0d9fa78a</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="261308" url="~/discussions/f/rules/37263/expression-rule/139399"]The requirement is not clear. [/quote]
&lt;p&gt;I like defaulting to the laziest approach possible when the requirements aren&amp;#39;t actually spelled out.&amp;nbsp; For instance, the result here is just a rule that returns &amp;quot;(A1;A2)&amp;quot;, without specifying how the rule input (if any) is related to that (and my brain is too fried to try guessing).&lt;/p&gt;
&lt;p&gt;So here&amp;#39;s my initial rule suggestion:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;&amp;quot;(A1;A2)&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Straightforwardness: 10/10.&amp;nbsp; Flexibility for different rule inputs: ??/10.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/139445?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2024 12:48:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ced28267-7b83-4b04-bb5b-660bf3ffb8f9</guid><dc:creator>Kumar Agniwesh</dc:creator><description>&lt;p&gt;Hi, based on your input and output I am guessing you are trying to concatenate two inputs n number of times. if so, below snippet could be helpful&lt;/p&gt;
&lt;p&gt;for&lt;pre class="ui-code" data-mode="text"&gt;a!forEach(
  items: enumerate(ri!integer)+1,
  expression: concat(ri!text,fv!index)
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/139404?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2024 04:59:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:91bb5068-5778-40f1-b2e0-124a1169b4ae</guid><dc:creator>Konduru Chaitanya</dc:creator><description>&lt;p&gt;How are you passing this value?&lt;/p&gt;
&lt;p&gt;Also as Yogi Patel mentioned create a Rule input of text type and try this.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!value: ri!ruleInput,
  local!integer: cleanwith(local!value, &amp;quot;1234567890&amp;quot;),
  local!alphabet: stripwith(local!value, &amp;quot;123456789(),&amp;quot;),
  local!listOfInt: enumerate(tointeger(local!integer)) + 1,
  a!forEach(
    items: local!listOfInt,
    expression: concat(local!alphabet, fv!item)
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I would ask you to please share what you have tried and what exactly is the requirement.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/139399?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2024 03:47:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:90078ad3-2372-441c-82b1-2c8c98061e17</guid><dc:creator>Yogi Patel</dc:creator><description>&lt;p&gt;The requirement is not clear. Share more details.&lt;/p&gt;
&lt;p&gt;You can create a rule input of Text type and then pass comma-separated data in that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>