cancel
Showing results for 
Search instead for 
Did you mean: 

Insert Value(s) in Lookup Flat Multi-valued Table with Java API

Former Member
0 Kudos

I've been looking in MDM Java API Library Reference Guide, MDM SP4 API JavaDoc, and SDN Forums for information on how to Insert/Update different values in a field in the Main Table of a given repository that belongs to a Lookup Flat Multi-valued Table using the Java API with no success.

I also haven't been successful in adding this values in the same way that I'll add a single value, using the MDM Java API, in a single-value Lookup Table (a2iFields.Add(new A2iField(FIELD_CODE,FIELD_VALUE)) for each value I want to add, like for example:

a2iFields.Add(new A2iField("Country","USA")

a2iFields.Add(new A2iField("Country","Mexico")

a2iFields.Add(new A2iField("Country","Germany")

Can anybody point me to the correct documentation that I need to read to fulfill this task? Or, even better, if someone can post a piece of code, I'll be more thankful.

Thanks for your help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You will have to use A2IStringArray for putting the value in MultiValued field.

Create A2IStringArray. Add all the values you want into that array by Add function. And then pass the array to A2IField array.

Hope this helps.

Thanks and Regards,

Mausam

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for the help guys, I've already figure that this had to be solved with an Array.

Regards..

Former Member
0 Kudos

HI,

little code example, where you add existing lookup values based on there record id:

int USA = 1;

int GERMANY = 2;

A2iValueArray countryArray = new A2iValueArray();

countryArray.Add(new Value(USA));

countryArray.Add(new Value(GERMANY));

A2iFields record = new A2iFields();

record.Add(new A2iField("Country", new Value(countryArray)));

Please reward points if helpful.

Regards,

Robert

Former Member
0 Kudos

Hi,

i found this piece of code in the API Reference Guide

A2iFields a2iFields = new A2iFields();
a2iFields.Add(
new A2iField("Part Number", new Value("ABC-123")));
a2iFields.Add(
new A2iField("Manufacturer", new Value(100)));
a2iFields.Add(
new A2iField("Category", new Value(40)));
a2iFields.Add(
new A2iField("Price", new Value(9.90)));
int id =
catalogData.AddRecord("Products", a2iFields, 0, 0);

Perhaps: CreateAddRecordsCommand Method (Returns an object for adding multiple records) is useful for you.

Hope this helps