<?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 part numbers from part IDs</title><link>https://www.aras.com/community/f/development/55297/how-to-get-part-numbers-from-part-ids</link><description>I have a query that returned a large number of part IDs that have a single eBOM item ID. 
 To get the part IDs converted to part numbers I used the AML &amp;quot;idlist&amp;quot; function. 
 How can I get the part BOM IDs converted to part numbers and keep the relationship</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to get part numbers from part IDs</title><link>https://www.aras.com/community/thread/10502?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2024 14:23:45 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:ae54c1b3-9900-4ec5-9a4f-ef1d8369ec0b</guid><dc:creator>dkinsley</dc:creator><description>&lt;p&gt;AJ,&lt;/p&gt;
&lt;p&gt;Hopefully this is just a one time need. Thank you so much for all your help with this. Never could have done it without your help!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have a great day!&lt;/p&gt;
&lt;p&gt;-Don&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get part numbers from part IDs</title><link>https://www.aras.com/community/thread/10499?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2024 13:22:09 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:71da6f24-8cde-4131-8f24-d4c3f0144f7c</guid><dc:creator>AJ Sebastian</dc:creator><description>&lt;p&gt;If I&amp;#39;m understanding you correctly here, you&amp;#39;re looking for the part numbers of all the child parts for BOM relationships with exactly 1 child.&lt;br /&gt;&lt;br /&gt;If you don&amp;#39;t care about the IDs, we should be able to modify the above script very slightly to get you what you need.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&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();
  //this is each relationship with 1 child part
  if (bomRel.getItemCount() == 1){
    //this related_id is the child Part, bomRel.getID() would actually get us the ID of the BOM Relationship.
    //relPartList.Add(bomRel.getProperty(&amp;quot;related_id&amp;quot;));
    //What we want is to get the actualy child part which is the related_id of the BOM relationship
    var relPart = inn.getItemById(&amp;quot;Part&amp;quot;,bomRel.getProperty(&amp;quot;related_id&amp;quot;));
    //now that we have access to the related part, we can simply query the part number
    var itemNumber = relPart.getProperty(&amp;quot;item_number&amp;quot;,&amp;quot;&amp;quot;);
    sourcePartList.Add($&amp;quot;Part Num: {currPart.getProperty(&amp;quot;item_number&amp;quot;,&amp;quot;&amp;quot;)}, Related Part Num: {itemNumber}&amp;quot;);
  }
}

return inn.newResult(&amp;quot;Parts with 1 Item in EBOM:\n&amp;quot; + String.Join(&amp;quot;\n&amp;quot;,sourcePartList));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This returned the following output in my test system (only one instance of this occurring):&lt;/p&gt;
&lt;pre&gt;&amp;lt;Result&amp;gt;Parts with 1 Item in EBOM:
Part Num: test, Related Part Num: BC-BELL&amp;lt;/Result&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;Now with over 9000 parts this method might not run too quickly, but it should get you the answer you&amp;#39;re looking for. If this is something you&amp;#39;re going to run routinely let me know and I can see if there&amp;#39;s a better way to run this query more efficiently.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get part numbers from part IDs</title><link>https://www.aras.com/community/thread/10495?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2024 21:08:55 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:37925040-f8d6-4da7-8f6f-619621b2d2ed</guid><dc:creator>dkinsley</dc:creator><description>&lt;p&gt;Hi AJ,&lt;/p&gt;
&lt;p&gt;With help, the script you provided has been modified to include the single eBOM item ID as follows:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;var inn = this.getInnovator();&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;var parts = inn.newItem(&amp;quot;Part&amp;quot;,&amp;quot;get&amp;quot;);&lt;/span&gt;&lt;br /&gt;&lt;span&gt;parts = parts.apply();&lt;/span&gt;&lt;br /&gt;&lt;span&gt;List&amp;lt;string&amp;gt; relPartList = new List&amp;lt;string&amp;gt;();&lt;/span&gt;&lt;br /&gt;&lt;span&gt;List&amp;lt;string&amp;gt; sourcePartList = new List&amp;lt;string&amp;gt;();&lt;/span&gt;&lt;br /&gt;&lt;span&gt;for (int i = 0; i &amp;lt; parts.getItemCount(); i++){&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; var currPart = parts.getItemByIndex(i);&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; var bomRel = inn.newItem(&amp;quot;Part BOM&amp;quot;,&amp;quot;get&amp;quot;);&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; bomRel.setProperty(&amp;quot;source_id&amp;quot;,currPart.getID());&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; bomRel = bomRel.apply();&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; if (bomRel.getItemCount() == 1){&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; relPartList.Add(bomRel.getProperty(&amp;quot;related_id&amp;quot;));&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; sourcePartList.Add($&amp;quot;Part ID: {currPart.getID()}, Related Part ID: {bomRel.getID()}&amp;quot;);&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;return inn.newResult(&amp;quot;Parts with 1 Item in EBOM:\n&amp;quot; + String.Join(&amp;quot;\n&amp;quot;,sourcePartList));&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Now my results are in this format:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Part ID: 858130EDB8604EE394BD8937B2B95A22, Related Part ID: 7345A108DF2C42A7A9E869A39DD6FA2D&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Part ID: 028128A1047846448C354C1E02FBC310, Related Part ID: 6EA253E00BC546AEB19014414F7C021F&amp;lt;/Result&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Prior, with your script, I took the resulting string of comma separated part IDs and used the AML function idlist as you suggested. I was going to try and get the related eBOM part numbers the same way if they return in the same order as the part numbers.&amp;nbsp; I have over 9,000 parts. The IDs don&amp;#39;t mean anything to the Engineers.&amp;nbsp; I need to get these IDs converted to part numbers and there are too many to do it manually - maybe there is an easier way?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Thank you,&lt;br /&gt;&lt;/span&gt;&lt;span&gt;-Don&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get part numbers from part IDs</title><link>https://www.aras.com/community/thread/10494?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2024 20:49:39 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:92c96e71-1038-4c42-8515-e984a9d02e39</guid><dc:creator>AJ Sebastian</dc:creator><description>&lt;p&gt;Hi Don,&lt;/p&gt;
&lt;p&gt;Just curious for more context here. Is this an operation you&amp;#39;re attempting to run once, or is it something you&amp;#39;ll have to do routinely? The solution I gave you previously works well for a one off query, but might not work well at scale or for repeated use.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you give me a little context I can hopefully help with a solution that better fits your needs.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;AJ&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>