<?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>Not a single item</title><link>https://www.aras.com/community/f/development/3904/not-a-single-item</link><description>I’m trying to retrieve a value from a legacy database using federation. Here is what I’ve done:
1. Added a new field in “Part” ItemType “and named it “min_total_stock” with type “Federation”
2. Added field “min_total_stock” to Part FORM
3. Created a new</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: Not a single item</title><link>https://www.aras.com/community/thread/2008?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 10:35:31 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:83941f19-505d-4b81-91cb-f6a3aadbe75a</guid><dc:creator>Christopher Gillis</dc:creator><description>Hello,

I believe the issue you&amp;#39;re running into is that the context item from onAfterGet server event is the collection of items returned from the get query. The &lt;strong&gt;not a single item&lt;/strong&gt; error is being thrown on &lt;code&gt;string masterpart = this.getProperty(&amp;quot;item_number&amp;quot;);&lt;/code&gt; because the &lt;strong&gt;getProperty&lt;/strong&gt; function cannot be called on a collection.

The simplest way to work around this issue would be to wrap the bulk of your code in a for loop and call it for each individual item in the collection like so.

&lt;pre&gt;&lt;code&gt;for (int i = 0, length = this.getItemCount(); i &amp;lt; length; i++)
{
Item currItem = this.getItemByIndex(i); // Select one item at a
string masterpart = currItem.getProperty(&amp;quot;item_number&amp;quot;);
// Put the rest of your code in this loop too
}&lt;/code&gt;&lt;/pre&gt;


Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not a single item</title><link>https://www.aras.com/community/thread/2007?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 10:35:30 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:360fc62d-63af-4dae-b63a-a5b3c224510c</guid><dc:creator>Christopher Gillis</dc:creator><description>Hello,

I believe the issue you&amp;#39;re running into is that the context item from onAfterGet server event is the collection of items returned from the get query. The &lt;strong&gt;not a single item&lt;/strong&gt; error is being thrown on &lt;code&gt;string masterpart = this.getProperty(&amp;quot;item_number&amp;quot;);&lt;/code&gt; because the &lt;strong&gt;getProperty&lt;/strong&gt; function cannot be called on a collection.

The simplest way to work around this issue would be to wrap the bulk of your code in a for loop and call it for each individual item in the collection like so.

&lt;pre&gt;&lt;code&gt;for (int i = 0, length = this.getItemCount(); i &amp;lt; length; i++)
{
Item currItem = this.getItemByIndex(i); // Select one item at a
string masterpart = currItem.getProperty(&amp;quot;item_number&amp;quot;);
// Put the rest of your code in this loop too
}&lt;/code&gt;&lt;/pre&gt;


Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>