cancel
Showing results for 
Search instead for 
Did you mean: 

How to upload Image to MDM 5.5 SP3 using Java APIs

Former Member
0 Kudos

Hi,

I am trying to upload Image to Images table in MDM 5.5 using JAVA API for MDM. But. I'm not able to find particular field in Images table where I need to set the Blob object ( Image data ).

I'm not aware of the method to set the Blob, there is one for getting the Image data.

I have gone through forums posts and tried the code. But with no luck....

I think this code is for some other MDM version as the fields mentioned are not present in the Images table e.g. DataObject - this field is used in the above posts to set the Blob data but this field does not exist in Images table in MDM 5.5

Can anyone suggest the solution?

Thanks and Regards,

Mausam

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mausam,

Please try the following:


// adding to a image table

// get the bytes for the image
byte[] imageBuf = readFile("C:\pic.bmp");

// setup A2iFields
fields = new A2iFields();
fields.Add(new A2iField("DataObject", new
Value(imageBuf))); // the image binary (required)
fields.Add(new A2iField("Name", new Value("pic.bmp")));
// a name for the image
fields.Add(new A2iField("OrigName", new
Value("pic.bmp"))); // the original image file name
(required)
fields.Add(new A2iField("DataGroupId", new Value(888)));
// the data group to add to (required)
fields.Add(new A2iField("OrigLocationId", new
Value(999))); // the data location of the image
(required)
fields.Add(new A2iField("Description", new Value("a
short description"))); // a short description here
// add the image
String imageTable = "Images";
catalog.AddRecord(imageTable, fields, -1, -1);

It's taken out of the API guide for SP3 (the example for method AddRecord.

Best regards,

Amit

Former Member
0 Kudos

Hi Amit,

Thanks for the reply.

I had done the same thing before. But the problem is, there is no field called "DataObject" in Images table and hence the code gives error "java.lang.RuntimeException: Field DataObject doesn't exist in table Images".

If you go to Image Manager, the field in which you see the image is "Image". I tried to set bytes array value there also but the program give the same error saying " Field Image dosn't exist in table Images"

Does anyone know in which field actually the data of the Image goes??

Regards,

Mausam

Former Member
0 Kudos

Hi mausam

Actual name for Image field is "Data ID"and its type is also Data ID.

but where to add the image blob? there is no field like "DataObject" which accepts byte[] array. I think the Data ID(image) feild stores the image..but its type is data ID...how to fetch data ID?

If u have solved this issue...plz help me out.

Thanks and regards

swati

Answers (0)