Skip to main content

Posts

Showing posts with the label break in switch cases

Value in Table column getting blank during Excel import by code in Axapta

If you have written code to import data in Ax Table using Excel template and getting value blank in any column which is string type but value is mentioned in Excel column. After checking that column value getting that number entered in string field and import code not able to pick number in string field  to handle that situation you need to write below code for particular field . switch(Cells.Item(Rownum, 11).value().variantType()) { case COMVariantType::VT_BSTR: accNo = strFmt("%1", Cells.Item(Rownum, 11).value().bStr()); break; case COMVariantType::VT_DECIMAL, COMVariantType::VT_R4, COMVariantType::VT_R8: accNo = strFmt("%1", any2int(Cells.Item(Rownum, 11).value().double())); break; case COMVariantType::VT_I1, COMVariantType::VT_I2, COMVariantType::VT_I4: accNo = strFmt("%1", Cells.Item(Rownum, 11).value().int()); break; case COMVariantType::VT_UI1, COMVariantType::VT_UI2, COMVariantT