Delete a complete BOM (if any) using Batch Loader

Hello,

I am learning how to use the batch loader to add a BOM to a specific part, but now I would like to do the opposite: I would like to come up with a script I can run with the Batch Loader that would delete a BOM regardless of how many components it has. How could I get started on this?

Regards,

PMateo

Parents
  • I think it´s possible to delete all elements of type 'Part_BOM' which has the source_id of your parent Part. 

    <Item type="Part_BOM" action="delete" where="[Part_BOM].source_id='123456....'"></Item>

    Not tested! Use with care :-).

  • I think I am close, I have the following:

    <Item type="Part BOM" action="delete" where="Part_BOM.source_id='@1'"></Item>

    The parent part number I am reading from a file, first column. I am not getting errors during execution, but the part BOM is still there (the command did not delete the BOM, I can still see it in the part). I think this line makes perfect sense so I will look into it again and see if I missed anything. I also tried the following script:

    <!-- To delete a complete BOM, round 2, no errors but not working -->
    <Item type="Part" where = "item_number = '@1' and is_current = '1' " action="edit">
     <Relationships>
      <Item type = "Part BOM" action = "delete" where="Part_BOM.source_id='@1'"></Item>
     </Relationships>
    </Item>

    Should I change my approach, or am I on the right track?

  • Hi Pmateo

    It should be on opposite way. You need to use the related_id. (Source ID is ID of Parent Part and Related ID is ID of Child Part)

    Example: 

    Parent1 --> Child1

    Parent2 --> Child1

    If you want to delete Child1 in Parent1 and Parent2. Use below query

    <AML>
    <Item action='delete' type='Part BOM' where="[Part_BOM].related_id='773D6786B7DE48439F373F59'"></Item>
    </AML>

    Here Related ID is ID of the Child1.

    Hope it helps.

    Thank You

    Gopikrishnan 

  • Hi. Thanks a lot for the suggestion. Even when I run the query as you specified I don't get any errors, but the BOM stays in place. I am starting to believe something is preventing me from deleting BOM using queries (manually I can).

    If I understand correctly, the query you sent would delete Child1 everywhere right? If it belongs to 10 parents, then all 10 parts will have Child1 deleted. I was trying to go the other way around, I want to delete all child parts from a given parent, regardless of how many there are in one go; that's where I got the query <Item type="Part BOM" action="delete" where="Part_BOM.source_id='@1'"></Item> but exactly as when I ran yours: no errors show up but the BOM doesn't change. I will re-read the documentation in the developers forum and give it another try.

  • Hi Pmateo

    Yes, it will delete Child1 every where it is used and your query is correct and it should delete all bom in parent/ May I know using which account you are running the query ? 

    Also try with get query instead of delete in AML studio first. If it works, can you run the delete query in AML studio first and see the result.

    <AML>

    <Item type="Part BOM" action="get" where="Part_BOM.source_id='@1'"></Item>

    </AML>

     

    Thank You

    Gopikrishnan

  • Hello Gopikrishnan,

    I am running the queries using the batch loader, using the root account which acts as a superuser (whenever I modify a part using the server the note attached is "modified by: superuser"). Oddly enough, when I ran your query I got an error saying that "No items of type Part BOM found."

    I will use the Innovator Admin tool on GitHub and give it a try. However, this only happens when I try to delete, I am able to add child parts to the parents with no issues. I just started using the batch loader this week, so I am starting to think that the batch loader is meant for loading, not deleting or other queries.

    Kind regards,

    Pedro

  • Hi

    Batch loader is meant for running the AML queries in batches irrespective of the action. So, ideally it should work.

    I would suggest you to run the AML query in Innovator Admin or Nash URL and make it working and use the same query in batch loader. This should return all the BOM for Parent1. Replace @1 with 1 Parent Part ID.

    <AML>

    <Item type="Part BOM" action="get" where="Part_BOM.source_id='@1'"></Item>

    </AML>

    Thank You

    Gopikrishnan

  • Hi. I got an error even using Nash URL; I need to do some more research into the configuration of ARAS or my account setup, or I may ask someone else to run the scripts for me and see what they get, something doesn't seem right.

    Thank you,
    Pmateo

Reply
  • Hi. I got an error even using Nash URL; I need to do some more research into the configuration of ARAS or my account setup, or I may ask someone else to run the scripts for me and see what they get, something doesn't seem right.

    Thank you,
    Pmateo

Children
No Data