<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Inventor VBA BOM sorting issue with custom order &amp;quot;Array&amp;quot; in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-vba-bom-sorting-issue-with-custom-order-quot-array-quot/m-p/11853098#M150632</link>
    <description>&lt;P&gt;In general you need to call&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-DB88517D-8351-4A5F-A72C-D279713C22DC" target="_blank" rel="noopener"&gt;BOMView.Sort Method&lt;/A&gt; correctly. This method doesn't accept array as argument.&lt;/P&gt;&lt;P&gt;If you can, use iLogic instead of VBA. There is more powerful tools for sorting.&lt;/P&gt;&lt;P&gt;See this previous posts&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/order-bom-based-on-part-number-not-alphabetical/m-p/11698261/highlight/true#M148119" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/renumber-structured-bom-with-gap-in-numbering-based-on-part/m-p/11789545#M149613" target="_blank" rel="noopener"&gt; here&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 11:05:44 GMT</pubDate>
    <dc:creator>Michael.Navara</dc:creator>
    <dc:date>2023-03-28T11:05:44Z</dc:date>
    <item>
      <title>Inventor VBA BOM sorting issue with custom order "Array"</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-vba-bom-sorting-issue-with-custom-order-quot-array-quot/m-p/11851986#M150619</link>
      <description>&lt;P&gt;I am using Inventor VBA to sort a Bill of Materials (BOM) based on a custom order defined in my VBA code. I have created an array with the desired order of the BOM items and I am using the oBOMView.Sort method to sort the BOM based on the CS_Description field and the custom order.&amp;nbsp;&lt;/P&gt;&lt;P&gt;currently, I got an error and am not able to figure out how to solve it.&amp;nbsp; the below line has "type mismatch" error.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt; Call oBOMView.Sort(Array("CS_Description", "CustomOrder"), Array(True, True), sortOrder)&lt;/LI-CODE&gt;&lt;P&gt;the rest of the section is below. I am trying to use the array.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim oBOM As BOM
Dim oBOMView As BOMView
    Set oBOMView = oBOM.BOMViews.Item("Structured")
Dim sortOrder(12) As String
    sortOrder(0) = "description 1"
    sortOrder(1) = "description 2"
    sortOrder(2) = "description 3"
    sortOrder(3) = "description 4"
    sortOrder(4) = "description 5"
    sortOrder(5) = "description 6"
    sortOrder(6) = "description 7"
    sortOrder(7) = "description 8"
    sortOrder(8) = "description 9"
    sortOrder(9) = "description 10"
    sortOrder(10) = "description 11"
    sortOrder(11) = "description 12"
    'CS_Description is my custom property.
    Call oBOMView.Sort(Array("CS_Description", "CustomOrder"), Array(True, True), sortOrder)

Call oBOMView.Renumber(1, 1)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 22:44:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-vba-bom-sorting-issue-with-custom-order-quot-array-quot/m-p/11851986#M150619</guid>
      <dc:creator>soykesa</dc:creator>
      <dc:date>2023-03-27T22:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor VBA BOM sorting issue with custom order "Array"</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-vba-bom-sorting-issue-with-custom-order-quot-array-quot/m-p/11853098#M150632</link>
      <description>&lt;P&gt;In general you need to call&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-DB88517D-8351-4A5F-A72C-D279713C22DC" target="_blank" rel="noopener"&gt;BOMView.Sort Method&lt;/A&gt; correctly. This method doesn't accept array as argument.&lt;/P&gt;&lt;P&gt;If you can, use iLogic instead of VBA. There is more powerful tools for sorting.&lt;/P&gt;&lt;P&gt;See this previous posts&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/order-bom-based-on-part-number-not-alphabetical/m-p/11698261/highlight/true#M148119" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/renumber-structured-bom-with-gap-in-numbering-based-on-part/m-p/11789545#M149613" target="_blank" rel="noopener"&gt; here&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 11:05:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-vba-bom-sorting-issue-with-custom-order-quot-array-quot/m-p/11853098#M150632</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2023-03-28T11:05:44Z</dc:date>
    </item>
  </channel>
</rss>

