Quantcast
Viewing all articles
Browse latest Browse all 1103

Prompt BOM structure from VB.NET

Hello,

I am trying to write a vb.net script to prompte a list of Part BOM relationships items from a selected Part. Below is my last try and the error was: "Not a single Item". I assume the error is because there is a set of Items, but I try to prompt the items by a "getItemByIndex()". Does anyone can help me out?

I wrote the same script within an ARAS Method and it's working fine, I do not understand why.

Below is my code:

        Dim part_select As Aras.IOM.Item = MyInnovator.getItemById("Part", "01391FC6931A4BFDB8A0BDB34C80D9DE")

        part_select = part_select.apply()

        Dim partBom As Aras.IOM.Item = MyInnovator.newItem("Part BOM", "get")
        partBom.setAttribute("select", "name,item_number")
        part_select.addRelationship(partBom)


        Dim count As Integer = part_select.getItemCount()
        Dim results As Aras.IOM.Item = part_select.apply()

        Console.WriteLine("Number of relation : " & count)
        Dim item As Aras.IOM.Item = results.getRelationships()
        Dim bom As Aras.IOM.Item = item.getRelatedItem()

        Dim i As Integer = 0
        For i = 0 To count
            Console.WriteLine("nom : " & bom.getItemByIndex(i).getProperty("name", "na"))
        Next

Thanks!

Xavier


Viewing all articles
Browse latest Browse all 1103

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>