cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a wide way to get MDM data in Java API

Former Member
0 Kudos

Hello,

I use Java API to get the data from MDM.

Sample Code

***************************

ResultSetDefinition rsd_products;

rsd_products = new ResultSetDefinition("Products");

rsd_products.AddField("No");

rsd_products.AddField("Product_Name");

Search search = new Search(rsd_products.GetTable());

A2iResultSet rs = catalogData.GetResultSet(search, rsd_products, null, true, 0);

for (int i = 0; i < rs.GetRecordCount(); i++) {

int num = rs.GetValueAt(i, "No").GetIntValue();

String name = rs.GetValueAt(i, "Product_Name").GetStringValue();

}

****************************

In this case, I have to write code with specific column name.

If possible, I want my program to be independent from the column names.

Does anyone know a good way to get data from tables ?

Regards.

Koji

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can use CatalogData.GetFields to get all the fields. With this you can use the iterator to build the ResultSetDefinition.

CMFieldInfoArray is the array of all fields.

<b>CatalogData.GetFields</b>

public CMFieldInfoArray GetFields(java.lang.String table)

throws StringExceptionRetrieves the list of fields from a table.

Parameters:

table - the table name.

Returns:

the list of field descriptions.

Throws:

StringException - invalid argument.

Former Member
0 Kudos

Thanks,

The tables I'm using have Flat lookup tables and Qualified tables.

In this case, will CMFieldInfoArray work?

And, Do I have to search several times with a key from other tables

When I get all data from related tables.

Regards.

Koji

Former Member
0 Kudos

Hi Koji,

CMFieldInfoArray will give you all the fields in the particular talbe.

Now if a field is of type LookUp Flat, you will get the value stored in that field. Like country is look up and you have assigned some country to a person. When you search Person table you will get the assigned values.

For Qualified fields, you will have to use some other functions in CatalogData. like GetQualifiedLinks.

And when you want to go further down in the search, you will have to search multiple times according to the key from other tables.

Hope this answers your questions.

Regards,

Mausam

Former Member
0 Kudos

Thanks.

I'm worried about perfomance.

As you said,

when I want to go further down in the search, I will have to search multiple times.

If othere tables were huge, would this way be OK ?

Is there a good way about performance like JOIN statements in SQLs.

Regards.

Koji

Former Member
0 Kudos

Hi Koji,

Even I was looking for the JOIN, but it seems with current APIs it is not possible.

You can search multiple tables by combining multiple FreeFormSearch parameters but finally the result will come into a ResultSet with defined ResultSetDefinition. And I dont see any method to combine 2 tables in ResultSetDefinition.

I'm not aware of MDM JAVA APIs 2. Please have a look that also.

Thanks and Regards,

Mausam

Answers (0)