<?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>Query help needed</title><link>https://www.aras.com/community/f/development/55279/query-help-needed</link><description>Can someone help me with an AML query to find... 
 
 all of our parts in Innovator that have only one item in the EBOM 
 what revision sequence each part is assigned 
 what the single EBOM item part number is 
 
 Don</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: Query help needed</title><link>https://www.aras.com/community/thread/10469?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2024 20:18:47 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:abed4326-43e6-4d1e-9865-83008b1835b0</guid><dc:creator>dkinsley</dc:creator><description>&lt;p&gt;AJ,&lt;/p&gt;
&lt;p&gt;Thank you so much for all your help!&lt;/p&gt;
&lt;p&gt;-Don&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query help needed</title><link>https://www.aras.com/community/thread/10468?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2024 20:00:25 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:c1466885-867b-4b46-b353-b92076f8773c</guid><dc:creator>AJ Sebastian</dc:creator><description>&lt;p&gt;If you want to get the related Items I&amp;#39;d recommend something like this&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;lt;Item type=&amp;quot;Part&amp;quot; id=&amp;quot;ACBDEF0123456789&amp;hellip;&amp;quot; action=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;Relationships&amp;gt;&lt;br /&gt; &amp;lt;Item type=&amp;quot;BOM&amp;quot; action=&amp;quot;get&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;/Relationships&amp;gt;&lt;br /&gt;&amp;lt;/Item&amp;gt;&lt;/p&gt;
&lt;p&gt;(This sample is directly from the&amp;nbsp;&lt;a href="/community/f/development/55279/query-help-needed/aras.com/community/DocumentationLibrary/ALL%20PDFs/Flare%20PDF/Flare%20PDF/Innovator%2029/Aras%20Innovator%2029%20-%20Programmer&amp;#39;s%20Guide.pdf"&gt;Programmers Guide&lt;/a&gt;, which you should check out for AML tips)&lt;/p&gt;
&lt;p&gt;This will show the relationship and should give you information about the related part.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query help needed</title><link>https://www.aras.com/community/thread/10467?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2024 19:56:43 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:fbf277b8-4e79-4d07-b7b2-a3980f51349e</guid><dc:creator>dkinsley</dc:creator><description>&lt;p&gt;Running the AM idlist attribute gave me all the part numbers with only one eBOM item but I still don&amp;#39;t have the part number or ID of the single eBOM item.&amp;nbsp; Did I miss something?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query help needed</title><link>https://www.aras.com/community/thread/10463?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2024 14:45:12 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:6de91460-bf76-48bf-898e-37ce244a0d47</guid><dc:creator>AJ Sebastian</dc:creator><description>&lt;p&gt;I went ahead and whipped up a quick method which you can add to your instance and execute to get all the parts with exactly 1 BOM Relationship:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;var inn = this.getInnovator();

var parts = inn.newItem(&amp;quot;Part&amp;quot;,&amp;quot;get&amp;quot;);
parts = parts.apply();
List&amp;lt;string&amp;gt; relPartList = new List&amp;lt;string&amp;gt;();
List&amp;lt;string&amp;gt; sourcePartList = new List&amp;lt;string&amp;gt;();
for (int i = 0; i &amp;lt; parts.getItemCount(); i++){
  var currPart = parts.getItemByIndex(i);
  var bomRel = inn.newItem(&amp;quot;Part BOM&amp;quot;,&amp;quot;get&amp;quot;);
  bomRel.setProperty(&amp;quot;source_id&amp;quot;,currPart.getID());
  bomRel = bomRel.apply();
  if (bomRel.getItemCount() == 1){
    relPartList.Add(bomRel.getProperty(&amp;quot;related_id&amp;quot;));
    sourcePartList.Add(currPart.getID());
  }
}

return inn.newResult(&amp;quot;Parts with 1 Item in EBOM: &amp;quot; + String.Join(&amp;quot;,&amp;quot;,sourcePartList));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To utilize this, you can create a new method in Innovator, make sure it&amp;#39;s a server method. Then once it&amp;#39;s saved you should be able to run the following action (Run Server Method):&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:124px;width:auto;" alt=" " src="/community/resized-image/__size/0x248/__key/communityserver-discussions-components-files/3/pastedimage1722264217971v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The output should pop up. It&amp;#39;ll be a list of IDs for all the parts that have exactly 1 BOM Relationship. After that you should be able to use that list for an AML Query using the idlist attribute.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;AJ&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query help needed</title><link>https://www.aras.com/community/thread/10462?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2024 13:48:27 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:6c2bf108-8deb-415f-af97-cef8983ee8ec</guid><dc:creator>dkinsley</dc:creator><description>&lt;p&gt;AJ,&lt;/p&gt;
&lt;p&gt;Thank you for your reply.&amp;nbsp; Unfortunately, I am not familiar with C# or where I would even do that query.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query help needed</title><link>https://www.aras.com/community/thread/10461?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2024 13:45:33 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:117008a7-4735-4e5e-9982-4dfe6f700365</guid><dc:creator>AJ Sebastian</dc:creator><description>&lt;p&gt;Hi Don,&lt;/p&gt;
&lt;p&gt;Is there a particular reason you&amp;#39;re using AML for this task? Personally I&amp;#39;d write a short C# Method to gather this information.&lt;/p&gt;
&lt;p&gt;The flow would look something like:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Get all Parts&lt;/li&gt;
&lt;li&gt;For each part, do a get on all Part BOM relationships with the same source ID&lt;/li&gt;
&lt;li&gt;Check how many relationships are returned in that get&lt;/li&gt;
&lt;li&gt;If count == 1, then we can use the related ID to get the information about the child part.&lt;/li&gt;
&lt;li&gt;Store in some list and return&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let me know if that works!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;AJ&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>