BOMComp[] access

BOMComp[] access

Jakub.Szymanik
Contributor Contributor
546 Views
2 Replies
Message 1 of 3

BOMComp[] access

Jakub.Szymanik
Contributor
Contributor

Hello,

 

One question regarding BOMComp[], what is the correct way to get to this? Please look at this function:

 

private void HandleBOMSelection(ISelection oneSelection, Connection oneConnection)
{
    Item selectedItem = oneConnection.WebServiceManager.ItemService.GetItemsByIds(new long[] { oneSelection.Id }).FirstOrDefault();

    ItemBOM itemBom = oneConnection.WebServiceManager.ItemService.GetItemBOMByItemIdAndDate(selectedItem.Id, selectedItem.LastModDate, BOMTyp.Historic, 
                        BOMViewEditOptions.Defaults | BOMViewEditOptions.ReturnOccurrences | BOMViewEditOptions.ReturnUnassignedComponents);

    var itemBomAssocArray = itemBom.ItemAssocArray;
    var itemBomRevArray = itemBom.ItemRevArray;
    var itemBomCompArray = itemBom.BOMCompArray;

    string string_itemBomAssocArray = string.Join("\n", itemBomAssocArray.Select(item => string.Join(", ", item.GetType().GetProperties().Select(prop => $"{prop.Name}: {prop.GetValue(item)}"))));
    string string_itemBomRevArray = string.Join("\n", itemBomRevArray.Select(item => string.Join(", ", item.GetType().GetProperties().Select(prop => $"{prop.Name}: {prop.GetValue(item)}"))));
    string string_itemBomRevArray = string.Join("\n", itemBomCompArray.Select(item => string.Join(", ", item.GetType().GetProperties().Select(prop => $"{prop.Name}: {prop.GetValue(item)}"))));
}
itemBomAssocArray and itemBomRevArray are ok, however itemBomCompArray is null. Why?
0 Likes
547 Views
2 Replies
Replies (2)
Message 2 of 3

jofa73W96
Explorer
Explorer

Hi, 

Not sure if it is helpful but here is a link I found useful on this topic: Component BOM Rows - It's All Just Ones and Zeros

0 Likes
Message 3 of 3

Jakub.Szymanik
Contributor
Contributor

Hello,

 

Thanks for the reply, but I already saw this post and still I don't know what I need to fix in my code to get rid of the null.

0 Likes