on 01-09-2008 11:40 PM
Hi Friends,
I am able to retrieve records of the main table using the "RetrieveRecordsByValueCommand" Object. Here i am getting values of all fields which are TEXT. But now i want to read the field values which are Taxonomy Lookup. How to read the Taxonomy attribute values of the main table record.
thanks for your time!!!
Thanks,
Raags
Plz refer to the URL[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30aa1447-80a1-2a10-e483-a76087bcb12f]
Rgds,
Krutarth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raags,
Please see the link below
[http://help.sap.com/saphelp_mdm550/helpdata/en/43/99c11b7d3e21b5e10000000a1553f6/content.htm]
Regards
Richa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, once you created the connection and the usersession MDM objects, you need the TableID object from the Taxonomy table with the attributes, then you need the RecordID Object from the record you want the values. Once you have this objects, all you need is this piece of code:
static public AttributeLink[] getAttributeLinks(ConnectionAccessor connection, String userSession,
TableId taxonomyTableID, RecordId taxonomyRecordID) {
RetrieveAttributeLinksCommand cmd = new RetrieveAttributeLinksCommand(connection);
cmd.setSession(userSession);
cmd.setTaxonomyTableId(taxonomyTableID);
cmd.setRecordId(taxonomyRecordID);
try {
cmd.execute();
} catch (CommandException e) {
e.printStackTrace();
}
return cmd.getAttributeLinks();
}
You will get an array of AttributeLinks type that you can convert to an AttributeProperties type like this
AttributeProperties[] attributes = new AttributeProperties[als.length];
for(int i=0, j=als.length; i<j; i++) {
attributes<i> = getAttribute(connection, userSession, taxonomyTableID, als<i>.getId());
}
Once you have the data on AttributeProperties, then you can go over the attributes types.
Please let me know if this help.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you had any success yet? I'm thinking my problem is version related.
Did you make sure to add additional result definitions for the lookup table? I believe you will need to do that for the taxonomy table before you are able to access the attributes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found something else that may be useful for you (from the migration document on service marketplace).
Since attributes and their assignments to taxonomy nodes are not part of the repository
schema (they are not maintained using MDM Data Manager), attribute identifiers cannot be
obtained using class RepositorySchema. Attributes are created and modified when a
repository is loaded and therefore attributes could possibly change during run time.
For this reason, any information about attributes must be retrieved using specialized
commands:
The first command RetrieveAttributesCommand is useful if you need a complete list of
all attributes defined for a given taxonomy table.
The second command RetrieveAttributeLinksCommand is preferable if you want to get
a list of all the attributes of a specific record that are available for setting their value. This
command evaluates the existing linkages to attributes of a given taxonomy node and
therefore returns only the valid attributes for a record which is already assigned to a taxonomy
node. This command returns an array of AttributeLink. From each of the array elements
you can retrieve the respective AttributeID and, for example, use this identifier for
composing the call of setAttributeValue().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I also am having this same problem. Have you found the solution to this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Raags,
as u could be awaare the Taxonomy mode File Import command immediately processes the import file one row at a time without the need for an options dialog. You can use the Import command to import multiple languages for the multilingual attribute properties as described in this section; the guidelines for doing so are summarized in the following table.
This URL could be helpful [http://help.sap.com/saphelp_mdm550/helpdata/en/43/99c11b7d3e21b5e10000000a1553f6/content.htm]
Rgds,
Krutarth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for responding Kruthart!!
Actually i havent asked the question properly. I am looking for JAVA API method to get the Taxomony field values for the given record of the main table.
Could anyone let me know how to read taxonomy field/attribute values of the main table's record?
Thanks,
Raags
Edited by: Raags on Jan 10, 2008 9:11 AM
This is my dilemma as well. I believe this code will work, I just haven't been able to get the rest working. Maybe you'll have more luck.
Here's what I know so far:
You must set this value to true (on the ResultSetDefinition), this will allow you to access the attributes:
rsd.setLoadAttributes(true);
This code will get the values of the attributes:
AttributeId[] attributes = record.getAttributes(fieldId);
for (int x=0;x<attributes.length;x++)
{
System.out.println(record.getAttributeValue(fieldId, attributes[0]));
}
Ok, I am partially there! I finally was able to get an actual value! My problem was that I was not checking if the MdmValue was multi-valued. After doing that, this code worked! I still have to do it for multi-values, but that should be the same, just looping through the values. Hope this helps you as well!
MdmValue mdmVal = rec.getAttributeValue(new FieldId("F24_29"),aid);
if(!mdmVal.isMultivalue()){
TextAttributeValue txtVal = ((TextAttributeValue) mdmVal);
AttributeId id = aid;
RetrieveAttributeCommand retAtt =
new RetrieveAttributeCommand(conn);
retAtt.setAttributeId(id);
retAtt.setSession(session);
retAtt.setTaxonomyTableId(new TableId("T5"));
try {
retAtt.execute();
TextAttributeProperties props =
(TextAttributeProperties) retAtt.getAttribute();
TextAttributeValueProperties[] val =
props.getTextAttributeValues();
for (int i = 0; i < val.length; i++) {
if (txtVal.getId().getIdValue() == val<i>.getId().getIdValue()) {
System.out.println("Name = " + val<i>.getName());
}
}
} catch (CommandException e) {
// TODO Auto-generated catch block
e.printStackTrace();
//trace.errorT("CommandException : " + e.getMessage());
}
}
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.