on 07-21-2005 4:28 PM
I have done most of the work,but i should get the record id for getting some iMage Info.
First i am adding fields into products then adding image.
is this approachright.
Hi Narayan/Nimrod,
Plz share us the implementation for getDataGroupIdByName(dataGroupName) method.
Thanks in advance,
Ananth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Narayan/Ananth,
You can get the datagroup id with this code:
int datagroupid = -1;
A2iStringArray values = new A2iStringArray();
//provide actual group name defined in using MDME Client
values.Add("datagroupname");
//Now do not change any value from the code below
ResultSetDefinition rsd = new ResultSetDefinition("DataGroup");
rsd.AddField("DataGroupField");
A2iResultSet rs = null;
rs = catalogData.GetRecordsByValue(values, rsd, "DataGroupField");
if (rs.GetRecordCount() > 0) {
datagroupid = rs.GetRecordIDAt(0);
}
If you still have any problem while importing images then feel free to discuss that.
Regards
Shahid Nadeem
Message was edited by: Shahid Nadeem
Hello Babu,
Please look at the following code example, if you are facing with additional problems, please write detailed description, thanks.
A2iFields mdmFields = new A2iFields();
// adding the "DataObject" - read the the bytes from the
// file then store it in variable
String filePath = "C:
temp
image.jpg";
File file = new File(filePath);
byte[] bytes = new byte[(int) file.length()];
// read byte from file, and set the large data
FileInputStream inputStream = new FileInputStream(file);
inputStream.read(bytes);
mdmFields.Add(new A2iField("DataObject", new Value(bytes)));
// adding the "DataGroupId"
String dataGroupName = "DataGroup for testing images";
// get the id of the dataGroupId, if the dataGroupName
//doesn't exist it will be added by the method
int dataGroupId = getDataGroupIdByName(dataGroupName);
mdmFields.Add(new A2iField("DataGroupId", new Value(dataGroupId)));
// adding the name
mdmFields.Add(new A2iField("Name", new Value(file.getName())));
mdmFields.Add(new A2iField("OrigName", new Value(file.getName())));
// adding OrigLocationId
int origLocationId = this.catalogData.AddDataLocation(filePath, 0, DataLocationType.RemovableMediaLocation);
mdmFields.Add(new A2iField("OrigLocationId", new Value(origLocationId)));
// adding the image to the "Images" table
int newImageId = this.catalogData.AddRecord("Images", mdmFields, 0, 0);
Good luck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Narayan,
Data Group is a group which contains BLOBs.
Loading Image to MDM requires to define the Data Group ID.
getDataGroupIDByName returns you the Data Group ID by name, if the Data Group name doesn't exist, the method will create it.
For example:
//the following example code will return "My Images" Data
//Group id, if "My Images" not exist, it will create it.
//
String dataGroupName = "My Images";
int dataGroupId = getDataGroupIdByName(dataGroupName);
Good luck, Nimrod.
Hi Nimod
Plz help me out regarding the following issue while adding image..
I am trying to add image in to repository, I have set Name, original name , data grp ID, original location ID, but how to set the image blob... i am not able to find any field named <i>DataObject</i> or a similar feild which can store the byte array.
Note- I am using MDM SP04.
Thanks in advance
swati
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.