It is useful to display an
image in a data grid on from to highlight certain records e.g.
records with validation errors as in the example below:
Adding a display method on
the table/form DataSource that returns an ImageRes.
display ImageRes errorExist()
{
#resAppl;
returnthis.ErrorLogged ? #ImageError
: #ImageBlank2;
}
Adding a new field control
on the form by right-clicking on the Grid control within the form design
and selecting New Control > Window
Set the properties of the
new control as follows:
AutoDeclaration=Yes
AllowEdit=No
Width=15
Height=15
Enabled=No
Skip=Yes
AlignControl=No
ImageMode=Size to fit
ShowLabel=No
DataSource=YourDataSourceName
DataMethod=DisplayMethodName like (errorExist) what we create in Table
Method.
If you want to Insert
image in table then use below Job to Insert Image in Table. Create Job and run
it.
staticvoidImageField(Args _args)
{
BinDatabinData = newBinData();
A_PurchaseOrder A_PurchaseOrder; //MyTableName
containerimageContainer;
strimageFilePathName;
imageFilePathName="ErrorLog.png"; //ImagePath
if (
WinAPI::fileExists(imageFilePathName))
{
binData.loadFile(imageFilePathName);
imageContainer = binData.getData();
//table.Image = _Party.RecId;
A_PurchaseOrder.ErrorLogged=
imageContainer;
A_PurchaseOrder.insert();
}
}
Now you are Done you can Insert and See Image in your form.
Thanks for comments.....