on 03-06-2007 1:17 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.