Forum Discussion

AngelaIp's avatar
AngelaIp
Ideator I
3 years ago
Solved

GetItemRepeatConfig removes child items that are used multiple times. How to fix?

Hi community, I use a classical "GetItemRepeatConfig" query to get a Part BOM over multiple levels.  id="xyz"; Item partItem = inn.newItem("Part","GetItemRepeatConfig"); partItem.setAttrib...
  • Gopikrishnan's avatar
    Gopikrishnan
    3 years ago

    I was also in a similar situation to expand the related items but couldn't able to make it using GetItemRepeatConfig when the item repeated in the BOM. I end up writing a SQL stored procedure to get the max level of a BOM and constructed an AML query to fetch the result. 

    Would like to hear from ARAS if there is any better solution for this issue or status of the bug.

    SQL Query

    CREATE PROCEDURE [getBOMLevels] @source_id NVARCHAR(MAX)
    AS
    BEGIN
    WITH RecursiveBOM(SOURCE_ID, RELATED_ID, indent_level) AS
    (
    SELECT pb.SOURCE_ID, pb.RELATED_ID, 0 FROM innovator.PART_BOM pb WHERE SOURCE_ID = @source_id
    UNION ALL
    SELECT pb1.SOURCE_ID, pb1.RELATED_ID, indent_level +1 FROM innovator.PART_BOM pb1
    INNER JOIN RecursiveBOM rb ON rb.related_id = pb1.SOURCE_ID
    )
    SELECT MAX(indent_level) AS BOM_Level FROM RecursiveBOM rb
    END

    Using this, I constructed the loop of BOM structure AML query.