Hello,
I'm trying to add a 'Text: Table Key Lookup' Attribute (Attribute Extension Module) to a Category using LAPI. This is, I'm trying to code something similar to this:

So far, all my attempts have failed. The piece of code I'm using is this:
LLValueattrInfo= new LLValue();
attrInfo.setAssoc();
attrInfo.add( "Type", 10013 ); // I can't find any ATTR_TYPE_<whatever> for 'Text: Table Key Lookup' (bad beginning, I guess)
attrInfo.add( "Required",true);
attrInfo.add( "Length",10);
attrInfo.add( "DisplayLen",10);
attrInfo.add( "FixedRows",true);
attrInfo.add( "MaxRows",1);
attrInfo.add( "NumRows",1);
attrInfo.add( "Search",true);
attrInfo.add("customSQL", true);
attrInfo.add("ValidValues", "SELECT DocumentCode FROM Codes");
status = attributes.AttrSet("DocumentCode", attrInfo, null, catVersion ); //catVersion had been initialized before
It does create the attribute but neither customSQL nor Values (SQL statement) are set, so the attribute doesn't work properly afterwards.
Is it possible to add a Lookup attribute using com.opentext.api.LAPI_ATTRSERVER.AttrSet?
If so, any ideas about what I'm doing wrong?
As an alternative, I've tried to copy a handmade Category version into a new version, but it doesn't work either. All attributes are copied, but customSQL and Values are lost. Code as:
LAPI_ATTRIBUTES attributes = new LAPI_ATTRIBUTES ( session );
LLValue catId = (new LLValue()).setAssocNotSet();
LLValue catVersion = (new LLValue()).setAssocNotSet();
catId.add("Type", LAPI_ATTRIBUTES.CATEGORY_TYPE_LIBRARY);
catId.add("ID", 53668); // handmade category
status = documents.FetchCategoryVersion(catId, catVersion);
if (status == 0) {
status = documents.CreateCategoryVersion(catId, catVersion);
}
Any ideas would be highly appreciated.
Thanks in advance.