« Back to University of Vienna - OMILAB

Trouble Accessing Attribute Values of an Attribute Profile

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Hi

I have started working with Attribute Profiles. I created a simple attribute profile class hierarchy using two classes where both have one attribute (besies the typical AttrRep, ClassAbstract etc.). I then created an instance in the modelling toolkit, set the value of the one attribute and tried to retrieve it using the following AdoScript:
1CC "Core" GET_ALL_ATTRPROF_SUBDIRS
2# Since right now there is only one instance this shouldn't be a problem
3CC "Core" GET_ALL_ATTRPROF_THREADS_IN_DIR apdirid:(VAL token(apdirids,0," "))
4SETL thingid:(VAL apthreadids)
5CC "Core" debug GET_ATTRPROF_CLASS_OF_THREAD apthreadid:(thingid)
6# Again since there is only one possible attribute this also shouldn't be a problem
7CC "Core" debug GET_ALL_ATTRS classid:(apclassid)
8CC "Core" debug GET_ATTR_VAL objid:(thingid) attrid:(VAL attrids)

Everything works with the exception of the last GET_ATTR_VAL call. This one returns an ecode:71 with errtext:"ATTRIBUTEOWNER_NOT_EXISTING". Could it have to do something with the class hierarchy? Or are the attribue values of Attribute Profiles accessed differently?

RE: Trouble Accessing Attribute Values of an Attribute Profile
attribute attribute profiles attribute profile class
Answer
3/19/18 10:12 AM as a reply to Patrik.
Similar as for model versioning you just have to get the version id from the thread → those are then the actual instances. Thus, you need one additional line:

 1
 2CC "Core" debug GET_ALL_ATTRPROF_SUBDIRS
 3CC "Core" debug GET_ALL_ATTRPROF_THREADS_IN_DIR apdirid:(VAL token(apdirids,0," "))
 4SET nApThreadIDs:(apthreadids)
 5
 6CC "Core" debug GET_ALL_ATTRPROF_VERSIONS_OF_THREAD apthreadid:(VAL token(nApThreadIDs,0," "))
 7SETL nApVersionIDs:(VAL apversionids)
 8
 9#This is a bit short-handed, assumes only one thread returned.
10CC "Core" debug GET_ATTRPROF_CLASS_OF_THREAD apthreadid:(VAL nApThreadIDs)
11CC "Core" debug GET_ALL_ATTRS classid:(apclassid)
12CC "Core" debug GET_CLASS_NAME classid:(apclassid)
13
14CC "Core" debug GET_ATTR_VAL objid:(nApVersionIDs) attrid:(VAL attrids)

Alternatively, you can use the AQL queries, instead of working with directories, to handle the instances directly.

RE: Trouble Accessing Attribute Values of an Attribute Profile
Answer
3/19/18 11:43 AM as a reply to Mateusz Dziedzic.
Thank you, it works now using the CC "Core" debug GET_ALL_ATTRPROF_VERSIONS_OF_THREAD ... you described.
Using AQL to access the Attribute Profiles also sounds interesting. How can I do that in AdoScript? How would the CC "AQL" EVAL_AQL_EXPRESSION ... look to access an Attribute Profile instance that is not assigned to any model/object attribute?