Static quantity in a BOM

Top  Previous  Next

Sometimes you want to force the number in a static quantity in a BOM. Here's an example of how you can do this, as long as the part you have inserted as the appropriate BOM unit.

 

void PutStaticQuantity(CComPtr<BOMRow>& pBomRow, const int ikUse)

{

   CString csQuantity;

 

   csQuantity.Format(L"%d",ikUse);

 

   CComBSTR bstrNewTotalQuantity = csQuantity ;

 

   // Do this *before* you do put_TotalQuantityOverridden

   HRESULT hRes = pBomRow->put_TotalQuantity(bstrNewTotalQuantity);

 

   // Do this after *put_TotalQuantity* is called

   hRes = pBomRow->put_TotalQuantityOverridden(VARIANT_TRUE);

}

 

 

 

 

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)