<?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>enumerate</title><link>https://community.appian.com/discussions/f/rules/11640/enumerate</link><description>Another technical question on how enumerate works. Can some one explain 
 index({10,30,40,50,60,70},enumerate(5),{}) 
 returns 
 
 
 10; 20; 20; 30; 40 
 Expected out 
 10; 20; 30; 40 
 But same works with below std code , but not sure why? 
 index({10</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: enumerate</title><link>https://community.appian.com/thread/101090?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2022 12:12:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0f33a769-3ba7-470d-a499-d94520ec8403</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;@stewart: &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f606.svg" title="Laughing"&gt;&amp;#x1f606;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: enumerate</title><link>https://community.appian.com/thread/101088?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2022 12:02:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c12ce586-ec3f-4946-8f33-bbc6615eecaa</guid><dc:creator>kavitar298810</dc:creator><description>&lt;p&gt;Oh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: enumerate</title><link>https://community.appian.com/thread/101087?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2022 12:01:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:63db2f6d-8de9-4679-9b5d-d663eac6d1a4</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Well &lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;, nostalgia isn&amp;#39;t what it used to be!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: enumerate</title><link>https://community.appian.com/thread/101086?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2022 11:56:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5185b7b8-30cc-4a04-af4a-3b54bf742498</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;This is a 4.5-year-old post...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: enumerate</title><link>https://community.appian.com/thread/101048?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2022 05:04:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:37aa506b-8ef0-44f1-936b-735bde20936b</guid><dc:creator>kavitar298810</dc:creator><description>&lt;p&gt;If you want to write 5 in an enum, so you will get that output&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/15/pastedimage1663045385891v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you can change it so you will get the same output as this&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/15/pastedimage1663045458703v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: enumerate</title><link>https://community.appian.com/thread/51348?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2018 11:04:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:094ea3f1-5f12-4ded-8781-d36b118b5f00</guid><dc:creator>Amit Mishra</dc:creator><description>Your expression means- index({10,30,40,50,60,70},{0,1,2,3,4},{}) but problem is with third argument {}.&lt;br /&gt;
Better use a default value. You&amp;#39;ll get desire output. &lt;br /&gt;
like - index({10,30,40,50,60,70},{0,1,2,3,4},0)  will give you  output- 0,10, 30,40,50&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Amit&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: enumerate</title><link>https://community.appian.com/thread/51309?ContentTypeID=1</link><pubDate>Wed, 03 Jan 2018 08:08:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0b0b1811-3e36-48f0-bcbc-f4c58b8bb5b1</guid><dc:creator>Ravi Roshan</dc:creator><description>try using in this way:&lt;br /&gt;
&lt;br /&gt;
apply(index({10,30,40,50,60,70},_,{}),enumerate(5))&lt;br /&gt;
&lt;br /&gt;
This will give you proper result. For the 0th index it will not return anything.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: enumerate</title><link>https://community.appian.com/thread/51304?ContentTypeID=1</link><pubDate>Wed, 03 Jan 2018 07:27:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:802d7bad-81bf-4ea5-8cd1-b0062d6a4fa9</guid><dc:creator>annap</dc:creator><description>&lt;p&gt;The problem is not in enumerate, it is in third parameter of &amp;quot;index&amp;quot; function. Don&amp;#39;t pass null array. problem will be solve.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: enumerate</title><link>https://community.appian.com/thread/51282?ContentTypeID=1</link><pubDate>Tue, 02 Jan 2018 18:22:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:25752c97-ec52-4424-b0b9-747bae20b355</guid><dc:creator>jacobm579</dc:creator><description>&lt;p&gt;Hey ganeshbabuj,&lt;br /&gt; &lt;br /&gt; I think you may have a typo and just wanted to clarify. You say that index({10,30,40,50,60,70},enumerate(5),{}) returns 20 but there is no 20 in the given list. Did you mean to write that index({10,20,30,40,50,60,70},enumerate(5),{}) is returning 10; 20; 20; 30; 40?&lt;br /&gt; &lt;br /&gt; This is the result that I got when I ran it.&lt;br /&gt; &lt;br /&gt; I believe it has something to do with casting {} to an integer. I replaced {} with an integer and it worked as intended. It also works with null.&lt;br /&gt; &lt;br /&gt; Thanks,&lt;br /&gt; Jake&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: enumerate</title><link>https://community.appian.com/thread/51261?ContentTypeID=1</link><pubDate>Tue, 02 Jan 2018 12:24:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:08a3e8d9-d702-4216-ac16-e6e615632625</guid><dc:creator>Vinay Kumar Rai</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;enumerate(5) : returns : {0,1,2,3,4},&lt;/p&gt;
&lt;p&gt;{10,30,40,50,60,70} : &lt;strong&gt;the Index of 10 is 1, 30 is 2 ans so on ,&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;INDEX : Has three parameters (array, index, default)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;strong&gt;Note: the default value should not be array type&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;index({10,30,40,50,60,70},enumerate(5),null)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OR&lt;/p&gt;
&lt;p&gt;index({10,30,40,50,60,70},{0,1,2,3,4},null)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;strong&gt;Returns:&lt;/strong&gt; null,10,30,40,50&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; Array start with 1 not 0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: enumerate</title><link>https://community.appian.com/thread/51260?ContentTypeID=1</link><pubDate>Tue, 02 Jan 2018 12:19:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1f37ced0-25f7-4f0f-b011-75643a1f6b46</guid><dc:creator>Shyam Bommakanti</dc:creator><description>enumerate(n) returns a list of integer numbers from 0 through n-1&lt;br /&gt;
enumerate(0) returns empty number list {}.&lt;br /&gt;
enumerate(1) returns {0}&lt;br /&gt;
enumerate(2) returns {0,1}&lt;br /&gt;
enumerate(3) returns {0,1,2}&lt;br /&gt;
enumerate(4) returns {0,1,2,3}&lt;br /&gt;
and so on.&lt;br /&gt;
&lt;br /&gt;
In your example the index is not returning as expected. &lt;br /&gt;
Enumerate returns integer list starting from 0 and array/list index starts from 1 in Appian. When index() gets invalid index (&amp;lt;=0) is returns whatever listed as default value.&lt;br /&gt;
index({10,20,30,40,50,60,70},enumerate(5),{}) = index({10,20,30,40,50,60,70},{0,1,2,3,4},{}) returning invalid list of numbers {10,20,20,30,40} &lt;br /&gt;
index({10,20,30,40,50,60,70},enumerate(5) + 1,{}) = index({10,20,30,40,50,60,70},{1,2,3,4,5},{}) returning valid list of numbers {10,20,30,40,50}&lt;br /&gt;
index({10,20,30,40,50,60,70},enumerate(5),1) = index({10,20,30,40,50,60,70},{0,1,2,3,4},1) returning valid list of numbers {1,10,20,30,40}&lt;br /&gt;
&lt;br /&gt;
index({10,20,30,40,50,60,70},enumerate(5),null) returns valid list of numbers {null,10,20,30,40}&lt;br /&gt;
&lt;br /&gt;
{10,20,30,40,50,60,70} is auto casted to List of Number (Integer) where a {} is casted to List of Variant. When returning index always returns the type array input. Merging list of variant and integer ending up with unexpected list.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>