Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
Error with AttrSetValues()
Michael_Brunner
Has anyone seen this error before when attempting to set an attribute value for a category?"AttrSetValues() failed: A list defined by the name 'Values' could not be found for the specified attribute."I have a predefined category with a couple simple string attributes already defined.I start by calling AttrInitCatVersion(cat.Name, catVersion)Setup the attribute with: attrInfo.add("Required", true); attrInfo.add("FixedRows", true); attrInfo.add("MaxRows", 1); attrInfo.add("NumRows", 1); attrInfo.add("Type", LAPI_ATTRIBUTES.ATTR_TYPE_STRFIELD); attrInfo.add("Rows", 1); attrInfo.add("Columns", 32); status = atts.AttrSet(att.Name, attrInfo, null, catVersion);And then attempt to set the attribute's value with: LLValue attrValuesPath = (new LLValue()).setAssocNotSet(); LLValue attrValues = (new LLValue()).setList(); attrValues.setSize(1); attrValues.setString(0, att.Value); status = atts.AttrSetValues(catVersion, att.Name, LAPI_ATTRIBUTES.ATTR_DATAVALUES, attrValuesPath, attrValues);I haven't seen a reference to that particular error anywhere.
Find more posts tagged with
Comments
eLink User
Message from Carsten Kulms via eLinkDid you initialize the catVersion parameter correctly? (You mention onlythat you use the AttrInitCatVersion function.)To use the AttrSetValues function, you have to initialize it with thecurrent category data (of an object):----8<--------8<--------8<--------8<----catVersion an Assoc value object initialized as a category versionthrough the FetchCategoryVersion or GetObjectAttributesEx function. Ifthe attrValuesType parameter is equal to ATTR_DEFAULTVALUES, the Assocvalue object can be initialized through the AttrInitCatVersionsfunction. ----8=--------8=--------8=--------8=----[Livelink API Developer's Reference Guide: Attribute API]I haven't tried but if the catVersion parameter is not initialized thisthe AttrSetValues function will fail internally, i.e. at client side, inthe attempt to update the data properly before transmitting the changesto LES.(I agree that it would nice if error messages would be explainedsomewhere in the LAPI documentation.)I've posted in this discussion a small (and non-production quality)example on how to use the AttrSetValues function a few weeks ago. If youcannot find it, please let me know, then I'll post it again.
Michael_Brunner
Thanks for the quick reply!I wasn't initializing the catVersion parameter correctly. However, even after fixing that I'm still getting the same error. The error message seems to imply that the AttrSetValues function is unhappy with the final parameter which contains the new attribute value. Perhaps I'm setting up the list incorrectly? Is the list supposed to have a name associated with it?
eLink User
Message from Carsten Kulms via eLinkI have no concrete idea. As long as you get this specific error there issomething wrong with catVersion parameter (afaik).Maybe you'll be able to catch the problem when you dump the catVersionafter it has been initialized. Simply print it to stdout. You should getsomething likeA<1,?,data=A<1,?,ID=1,Values={A<1,?,2=A<1,?,ID=2,Values={?}>>},CustomID=0>,catID=A<1,?,ID=92285,DisplayName=CatOne,Upgradeable=false,Version=1,Type=0>,definition=A<1,?,Required=false,DisplayName=CatOne,ValueTemplate=A<1,?,ID=1,Values={A<1,?,2=A<1,?,ID=2,Values={?}>>}>,Children={A<1,?,Required=false,DisplayName=TextField,Length=32,DisplayLen=32,Type=-1,NumRows=1,ID=2,RegionName=Attr_92285_2,MaxRows=1,Search=true,FixedRows=true>},Type=-18,NumRows=1,ID=1,MaxRows=1,NextID=3,FixedRows=true,Name=Cat_One>>> TextFieldA<1,?,Required=false,DisplayName=TextField,Length=32,DisplayLen=32,Type=-1,NumRows=1,ID=2,RegionName=Attr_92285_2,MaxRows=1,Search=true,FixedRows=true>I've attached a Java code example, hopefully this can help you to findwhat goes wrong. (The code is provided "as is", non production quality,use at your own risk!)
Nair_Krishnankutty_(nairkrishnankutty_-_(deleted))
The sample that OT provides as an example with category lapi always goes after the AttrInitCatVersion intializes these llvalue datstructurse before the actual AttrSet call.See the documentation*****************************Prepare parameter containersThe LL_ValueAlloc function allocates new value objects required as input parameters for functions in this program. Vaule object Use attrPath parent attribute path for sub-attributes of a Set defaultValues a list of default values for each attribute validValues a list of values for pop-up type attributes attrInfo an Assoc that will contain attribute definition specifications I do not see that in your excerpt can you try with that ?Carsten's posting also has that values.************************Here's the OpenText sample that I developed from bits and pieces of the documentation.I checked it still compiles and runs against a 9.5 sp1 system.If you want to atke a look at that also