Store Image

Hi,

I want to store the Image inside the table :

For Ex:

if I have I Item Table

ItemNo ItemImage

pen Image

pencil Image

in this way i want store the images can anyone share their ideas abt this.

Thanks in advance…

Hi,

you can use container data type with EDT set to Bitmap…

Arun.

Could you explain me detail with example.

Thanks for your reply,

Sunil kumar

in your example, the datatype of the field ItemImage should be as “container” and

Extended data type of that field should be as “Bitmap”.

Hope you understand.

  • Arun.

After that how can i store the image. How i can get the image into that field

Is it required any coding…?

I have extended the Bit map to my container field.

while creating record if i select container field its opening one more window there i can not choose any image how to archive this.

Regards

Sunil

hi,

you have to write code for that one…

use Inventory management-> Itemdetails → Setup button → Presentations → Image tab as a reference…

also see the CompanyImage form…

Hi All,

To store the image using container datatype try below steps:

  1. First to declare the binData and FilePath

Bindata binData = new BinData();
FilePath _path = ‘path of the image to store’;

  1. load the image file content to the binData object,

binData.loadFile(_path);

  1. Save to the table field which is a container type using below syntax,

binData.getData() → it will return the container type, you can directly store it to the table field.

Hope it will help you.

Hi,

I hope it could help you

create a button to add image to your record.

add this method

void clicked()
{
str fileName = yourtable.CopyOfFileName;
#winapi
image image = new image();
;

Image::canLoad(fileName);
image.loadImage(fileName);
yourtable.imageContainer = image.getData(); //this inserts your image in your table (to the appropriate record)
yourtable.doUpdate();

yourtable_ds.reread();
yourtable_ds.refresh();
}

HI,### Store image in table

Create a table with Container Datatype
IN form take a method getImage() write the following code.
_path = “Image path”
void getImage()
{
Bindata binData = new BinData();
FilePath _path;
ImageStore _ImageStore;

;
_path = “D:\India_flag.gif”; // file path
binData.loadFile(_path);

_ImageStore.ItemImage = binData.getData();
_ImageStore.doInsert();
}
__
take a button and call this method there:
void clicked()
{
super();

element.getImage();
ImageStore_ds.executeQuery();

}

HI Sunil,

I believe the best way to achieve it is to store image in CompanyImage table. For an instance, Try adding CompanyImage Display menu item on the CustTable form. Now when you open the CustTable form, you will be able to attach an image to the related customer record.

Thanks

Hi Arun,

please check the following code.

static void Report_image(Args _args)
{
Image image = new Image();
str filename;
Report_image Report_image;

;

filename = “C:\Temp\Image.gif”;
image.loadImage(filename);

Report_image.Image = image.getData();

}

By using this code ,i am getting error like “file open failed”.

please help me out.

regards,

Murali.