<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.aras.com/community/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>How To Get Single Part From Collection Of Items</title><link>https://www.aras.com/community/f/development/3292/how-to-get-single-part-from-collection-of-items</link><description>I have a collection of items and&amp;#160;&amp;#160;I want to retrieve single item from that --

If I write -

 return item_collection.getItemByIndex(0); &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; 

It is giving whole list of Items rather than the one present at 0.

Don&amp;#39;t know why is it behaving</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How To Get Single Part From Collection Of Items</title><link>https://www.aras.com/community/thread/528?ContentTypeID=1</link><pubDate>Tue, 06 Jun 2017 08:58:44 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:d9a3555e-1684-4022-9031-5177b6f11608</guid><dc:creator>Former Member</dc:creator><description>Thanks Guys! It worked..&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How To Get Single Part From Collection Of Items</title><link>https://www.aras.com/community/thread/527?ContentTypeID=1</link><pubDate>Tue, 06 Jun 2017 06:11:48 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:49d5b372-5ece-4032-be6e-ea85eef96e9c</guid><dc:creator>Zahar Chernov</dc:creator><description>Jasbir,

As I have mention in my previous answer using following syntax will return you specific Item in collection (or actually it&amp;#39;s XmlNode representation):

&lt;code&gt;item_collection.getItemByIndex(0).node&lt;/code&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How To Get Single Part From Collection Of Items</title><link>https://www.aras.com/community/thread/526?ContentTypeID=1</link><pubDate>Mon, 05 Jun 2017 14:36:37 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:808b07d7-cd12-4d8e-8214-1fd5826e90a6</guid><dc:creator>Bob Mengel</dc:creator><description>I was able to reproduce the same behaviour.

In order to get the single item returned I was successful with this line.

return this.getInnovator().getItemById(item_collection.getItemByIndex(0).getType(), item_collection.getItemByIndex(0).getID());

&amp;nbsp;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How To Get Single Part From Collection Of Items</title><link>https://www.aras.com/community/thread/520?ContentTypeID=1</link><pubDate>Mon, 05 Jun 2017 11:21:04 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:c363038b-0ccc-4386-87be-84fc463bcea1</guid><dc:creator>Former Member</dc:creator><description>@dlindinger : Thanks for your input, I tried this but it is also giving me whole list of items rather than the one present at node 0.

@Zahar : Thanks for your input, but is there any way I can return full Item rather than specific properties, as want all the properties inside it.

&amp;nbsp;

&amp;nbsp;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How To Get Single Part From Collection Of Items</title><link>https://www.aras.com/community/thread/515?ContentTypeID=1</link><pubDate>Fri, 02 Jun 2017 16:34:54 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:95337d60-7520-42fc-a830-91aa0dd7ac28</guid><dc:creator>Dennis Lindinger</dc:creator><description>I think you could also do something like this

Item returnItem =  item_collection.getItemByIndex(0);

return returnItem&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How To Get Single Part From Collection Of Items</title><link>https://www.aras.com/community/thread/514?ContentTypeID=1</link><pubDate>Fri, 02 Jun 2017 11:26:41 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:55f8d1f4-44d0-4d1b-8d9e-987b0c517af6</guid><dc:creator>Zahar Chernov</dc:creator><description>Jasbir,

Every Aras Item object includes the full collection + the item itself.

So when you access item at specific Index you can:
&lt;ol&gt;
 	&lt;li&gt;Access the item itself by using Aras methods (like getProperty() or setProperty())
for example this will return value of the property item_number:
&lt;blockquote&gt;item_collection.getItemByIndex(0).getProperty(&amp;quot;item_number&amp;quot;)&lt;/blockquote&gt;
&lt;/li&gt;
 	&lt;li&gt;Access the XmlNode behind this Item
for example this will return value of the property item_number using Xml:
&lt;blockquote&gt;item_collection.getItemByIndex(0).node.SelectSingleNode(&amp;quot;item_number&amp;quot;).InnerText&lt;/blockquote&gt;
&lt;/li&gt;
 	&lt;li&gt;Access the XmlDocument of the Collection
&lt;blockquote&gt;item_collection.getItemByIndex(0).dom&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;
&amp;nbsp;

&amp;nbsp;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>