BO to get full BOM through code

Does anyone know what BO I should be using to generate a full indented BOM through code? I am going to try BOMSearch, but I also wanted to see if anyone else knew while I was working on it.

Crazy? I know. But this is for a client who is MT so there are no other options. (The customization is a Button Click that calculates lead time). Also, I tried a BAQ but the recursive query does not work because of how they set up their parts.

2 Likes

Thanks Mark.

Thank @Chris_Conn! :wink:

1 Like

@Chris_Conn , @josecgomez , @hkeric.wci

Help! How is this method used? It returns a boolean not a dataset, so I am very confused.

My best guess is something like

BomSearchAdapter bsa = new BomSearchAdapter(oTrans);
bsa.BOConnect();
Boolean gdft = bsa.GetDatasetForTree(myPN, myRev, "", true, DateTime.Today, true);
if (gdft == true)
{
    DataSet bomDS = bsa.GetCurrentDataSet);
    //now I have the BOM in a dataset and can read from it??
}

Thanks.

The boolean is just there to indicate if the call was successful and didnt throw an exception… your DataSet would be filled into bsa

its easier if you rename your gdft to say success

if (bsa != null)
{
	foreach (var row in bsa.Tables[0].Rows) 
	{
		// todo
	}
}
2 Likes

Thank you!