cancel
Showing results for 
Search instead for 
Did you mean: 

Catalog Hierarchy using MDM Java API

Former Member
0 Kudos

Hello Everyone:

I'm building an iView for the EP and I've found this problem. I try to insert a new register using a simple webform. So I've managed to set up the whole scenario, but I've got a problem with a field located in hierarchy.

Categories table has the following elements:

1 - Filter

2 - Filter Case

3 - Filter Element

4 - Office Supply

5 - Paper

And they are placed under the following hierarchy:

Categories

|

|--- Office Supply

....

|....|--- Paper

|

--- Filter

.....

.....|--- Filter Element

.....|--- Filter Case

So in Java after I've set up all the fields I come up with something like:

A2iFields fields = new A2iFields();

.

.

.

fields.Add(new A2iField("Category", new Value(0)));

int newID = mdmBridge.AddRecord("Products",fields,0,0);

However I don't get it to work, it will only accept 0 as a parameter on the Category field and anything else throws an error. It inserts the Paper category.

Can anyone cast some light on this for me?

Thanks!

Alejandro

Message was edited by: Alejandro De Leon

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Alejandro,

The only acceptable values for the Category field of the Products table are the existing record ids of the Categories table. Therefore, search the Categories table (try using CatalogData.getRecordsByValue()) and get the record id from the resultset. Then use this record id as the value for the Category field.

Hope this helps,

Richard

Former Member
0 Kudos

Hello:

Thanks for the response. I'm sorry about this question, but, Which field is the id for the categories table? This table has the following structure:

idCategory, Name, Description, Group

I know that it might seem that the Id field is "idCategory" however it's not a display field and all of the registers on that field have null as value... is there a hidden field?

Thanks a lot!

Alejandro

Former Member
0 Kudos

Hi Alejandro,

The record ID i'm talking about is an internal id that every record has and it isn't visible anywhere.

Here's how you get the ID.

When you call the getRecordsByValue method, a ResultSet is returned. The ResultSet has a method called getRecordIDAt(int rowID) so you can loop through the entire ResultSet and get the record ID for each row that it returned. Since your search should only return 1 record, the following will work for you: ResultSet.getRecordIDAt(0)

This will return the record id of the first record in the ResultSet.

Hope this helps,

Richard

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Richard,

Can you tell how do I populate a drop down in EP to show hierarichal lookup in the similar form as in MDM, i.e., as a tree structure?

Thanks in Advance.