Skip to main content

Posts

Showing posts with the label UnitOfMeasureConverter_Product

Get unit conversion value of item in Ax 2012

To Get unit conversion value of item in Ax 2012 you can use below code. UnitOfMeasureConverter_Product is a class which has different method to give you converted value. Here example is showing to get conversion value from liter to kilo gram. UnitOfMeasureConverter_Product unitConverter = UnitOfMeasureConverter_Product::construct(); unitConverter.parmProduct(InventTable::find("TestIte",true).Product); unitConverter.parmFromUnitOfMeasure(UnitOfMeasure::unitOfMeasureIdBySymbol("ltr")); unitConverter.parmToUnitOfMeasure(UnitOfMeasure::unitOfMeasureIdBySymbol("kg")); unitConverter.parmRoundAbsoluteValue(NoYes::Yes); unitConverter.parmApplyRounding(NoYes::Yes); info(strFmt("%1",unitConverter.convertValue(1)));