<?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>Hey all, I&amp;#39;m interested in writing a simple expression rule which will</title><link>https://community.appian.com/discussions/f/rules/820/hey-all-i-m-interested-in-writing-a-simple-expression-rule-which-will</link><description>Hey all, I&amp;#39;m interested in writing a simple expression rule which will take two arrays (let&amp;#39;s say integers, for now), ri!bigArray and ri!smallArray -- and the return will be the indices (if any) of where any members of &amp;#39;small&amp;#39; are in &amp;#39;big&amp;#39;. Sort of like</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Hey all,&lt;br /&gt;I'm interested in writing a simple expression rule which will</title><link>https://community.appian.com/thread/2770?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2013 20:23:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:feb76c28-679a-45ba-b59b-ccd110365507</guid><dc:creator>Owen Parrish</dc:creator><description>I would discourage the use of undocumented functions.&lt;br /&gt;&lt;br /&gt;Instead, you could use reduce() and 2 expression rules to achieve the desired result:&lt;br /&gt;&lt;br /&gt;Rule 1&lt;br /&gt;--------&lt;br /&gt;Name: appendIndexIfContains &lt;br /&gt;Inputs: indices (Integer, Multiple), bigArrayValue (Integer), bigArrayIndex (Integer), smallArray (Integer, Multiple)&lt;br /&gt;Expression: =if(contains(ri!smallArray,bigArrayValue),append(ri!indices,ri!bigArrayIndex),ri!indices)&lt;br /&gt;&lt;br /&gt;Rule 2&lt;br /&gt;--------&lt;br /&gt;Name: getIndicesWhereBigContainsSmall&lt;br /&gt;Inputs: bigArray (Integer, Multiple), smallArray (Integer, Multiple)&lt;br /&gt;Expression: =reduce(rule!appendIndexIfContains, {},merge(ri!bigArray,enumerate(length(ri!bigArray))+1),ri!smallArray)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hey all,&lt;br /&gt;I'm interested in writing a simple expression rule which will</title><link>https://community.appian.com/thread/2769?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2013 19:51:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ebc04b49-b8f3-4b24-8ca6-06b9ee1bfa68</guid><dc:creator>Mike Schmitt</dc:creator><description>where() doesn&amp;#39;t have a way to replicate the functionality I was originally asking about, though (the ability to find the &amp;quot;where&amp;quot; indexes of multiple objects within an array).  wherecontains() certainly does, thanks to subhankarb for mentioning that.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hey all,&lt;br /&gt;I'm interested in writing a simple expression rule which will</title><link>https://community.appian.com/thread/2768?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2013 19:49:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e43f36aa-1404-4986-962b-b3b9da478e8b</guid><dc:creator>Owen Parrish</dc:creator><description>In 6.7 and greater there is a where() function:  &lt;a href="https://forum.appian.com/suite/wiki/latest/Array_Functions#where.28.29"&gt;forum.appian.com/.../Array_Functions&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hey all,&lt;br /&gt;I'm interested in writing a simple expression rule which will</title><link>https://community.appian.com/thread/2760?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2013 12:04:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f10843ad-d0b7-47df-9feb-80b0d5877c49</guid><dc:creator>moritzw</dc:creator><description>That&amp;#39;s definetely the nicest approach. &lt;br /&gt;&lt;br /&gt;I guess though that it&amp;#39;s possible that non documented functions can get deprecated in any release, right? Or are there maybe any other risks in using undocumented functions?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hey all,&lt;br /&gt;I'm interested in writing a simple expression rule which will</title><link>https://community.appian.com/thread/2759?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2013 11:53:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bf140a3b-2a5e-4f91-ba5b-0b2d8def7bf8</guid><dc:creator>subhankarb</dc:creator><description>Can also go for wherecontains(ri!smallArray,ri!bigArray). it is not an documented function. So you will not be able to search in appin expression editor. But using the function in exp editor will give you the desired output.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hey all,&lt;br /&gt;I'm interested in writing a simple expression rule which will</title><link>https://community.appian.com/thread/2746?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2013 19:33:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dfba345b-f443-49e3-952c-60173f475315</guid><dc:creator>moritzw</dc:creator><description>Yep. Something like this:&lt;br /&gt;=apply(fn!displayvalue, ri!values, ri!array, enumerate(count(ri!array))+1, &amp;quot;no&amp;quot;)&lt;br /&gt;would also work. Not sure which solution is better performance wise.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hey all,&lt;br /&gt;I'm interested in writing a simple expression rule which will</title><link>https://community.appian.com/thread/2745?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2013 19:13:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4db1e37f-9c85-4fec-859b-b6e197ba1eae</guid><dc:creator>shelzle</dc:creator><description>Maybe this one&lt;br /&gt;&lt;br /&gt;=apply(fn!displayvalue, {1, 5, 12}, {1,3,5,8}, {&amp;quot;one&amp;quot;, &amp;quot;three&amp;quot;, &amp;quot;five&amp;quot;, &amp;quot;eight&amp;quot;}, &amp;quot;no&amp;quot;)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hey all,&lt;br /&gt;I'm interested in writing a simple expression rule which will</title><link>https://community.appian.com/thread/2744?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2013 19:09:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:043a249a-4515-424e-950e-131bfe78b222</guid><dc:creator>Mike Schmitt</dc:creator><description>that appears to work, thanks a bunch.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hey all,&lt;br /&gt;I'm interested in writing a simple expression rule which will</title><link>https://community.appian.com/thread/2742?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2013 18:49:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:20e9724a-630d-480a-80b8-aa4dcef430ed</guid><dc:creator>moritzw</dc:creator><description>I just had the same requirment. I did the following. I create one rule with:&lt;br /&gt;where(ri!array=value,-1) // value being a single value&lt;br /&gt;and another one that is using apply:&lt;br /&gt;=apply(rule!GetIndexOfArrayWithValue,ri!values,ri!array) //values and array are both multiple&lt;br /&gt;&lt;br /&gt;not sure wether this is the most efficient way, but I didn&amp;#39;t come up with anything better.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>