How to insert/remove image in a table

If you need to import an image from your desktop to a table in dynamics AX, then you need a field which extendedDataType is bitmap and here is a code that you can write in the clicked method of your form

void clicked()
{
FilenameFilter filter = [‘Image Files’,’*.bmp;*.jpg;*.gif;*.jpeg’];
BinData binData = new BinData();
str extention, path, nameOfFile;
super();

imageFilePathName = WinAPI::getOpenFileName(element.hWnd(),filter,”, “@SYS53008″, ”,”);
if (imageFilePathname && WinAPI::fileExists(imageFilePathName))
{
[path, nameOfFile, extention] = fileNameSplit(imageFilePathName);
if (extention == ‘.bmp’ ||
extention == ‘.jpg’ ||
extention == ‘.gif’ ||
extention == ‘.jpeg’)
{
binData.loadFile(imageFilePathName);
imageContainer = binData.getData();
element.showLogo();
Thy_InventSymbolsIcons.Image = imageContainer;
}
else
{
throw error(“@SYS89176”);
}
}
element.Query_cntRecords();
}

then if you want to remove an image :
void clicked()
{
super();
element.delete();
}

and the delete mehtod is defined as follows:
void delete()
{;
Thy_InventSymbolsIcons.Image = connull();
Thy_InventSymbolsIcons_ds.refresh();
}