Is there a built-in report that I can run that will output all user-defined attributes in a given database? I am looking for a report that will include the GUID and the attribute name.
Rick Beddoe
Cargill Aris Technical Analyst
Minneapolis, MN, USA
Thanks Toven,
Finally got around to trying this. The problem is that it only outputs maintained attributes. I need the listing of all attributes that can be found in <database>->Configuration->Method->Attribute types
If anyone knows a way to get this table output as it is shown, that would be perfect. I can select the table and copy/paste, but that only gives the attribute name. I need to know Type number and API name
Cheers,
Rick Beddoe
Cargill Aris Technical Analyst
Minneapolis, MN, USA
Hi Rick,
Glad I can be of some help today.
I will post some ideas what you then can put togeter to give the output you need.
I am more interested in the filter been used, the objects and models and their attributes. In order to get the relevant attributes for a filter you need for example the object types:
var allowedobjtypes = ocurrentfilter.ObjTypes();
For each object type you can get the attributes defined (within the loop of allowed object types:
var attrtypenums = ocurrentfilter.AttrTypes(Constants.CID_OBJDEF, allowedobjtypes[i]);
For each attribute type number you can get the information:
Name: ocurrentfilter.AttrTypeName(attrtypenums[j])
API Name: ocurrentfilter.getAPIName(Constants.CID_ATTRDEF, attrtypenums[j])
Values (where applicable):
var aValueTypes = ocurrentfilter.AttrValueTypeNums(attrtypenums[j]);
for(var i1 in aValueTypes) {
aValues.push(ocurrentfilter.AttrValueType(attrtypenums[j], aValueTypes[i1]));
}
Hope this helps
Ciska
Hi Ciska,
This is PERFECT! I will post my code once it is complete.
One question I have, though. Notice the 'Type' column above. How do I get that information? I have tried many properties and methods of the above object but have not been able to find that information.
Regards,
Rick Beddoe
Cargill Aris Technical Analyst
Minneapolis, MN, USA
Hi Rick
As I see it you need to have the object/model/cnx type (eg OT_FUNC) in order to get the attribute type, if that is what you refer to. I never really required to have it differently. Keep in mind that certain attributes are only applicable to certain objects or wherever you can assign attributes to. Therefor it is never a good idea to output this based on entire method..... but I would, if no other way, get all the unique attributes for the models/objects/cnx in order to get the complete list of attributes.
You know this is also available in die documentation, tabularar pfd file?
Hope this answer your question.
Ciska
Hi Ciska,
I was able to get what I needed by using your previous semi-pseudo code ;)
Below is the code I came up with. You will see several custom 'libraries' that I've written that handle the data and presentation, but you should get an idea of the logic from the main code. This will give me all custom written attributes since none of them will have an API name starting with "AT_".
As for documentation, I have none. It's a long story how I ended up in this role. I'll tell you over a beer some time.
Cheers,
Rick Beddoe
Cargill Aris Technical Analyst
Minneapolis, MN, USA
var locale = Context.getSelectedLanguage(); // global variable, used throughout var oDatabase = ArisData.getActiveDatabase(); var oCargillData = new CARGILL_DATA(); var oCargillArisData = new CARGILL_ARIS_DATA(oDatabase, locale); var oCargillAttributes = new CARGILL_ARIS_ATTRIBUTES(); var oCargillExcel = new CARGILL_EXCEL("List of Attributes"); var oFilter = ArisData.ActiveFilter(); var allowedobjtypes = oFilter.ObjTypes(); var oAttTable = new oCargillData.DataTable("ARIS Attributes"); var _headers = [ {key:"TH_ATTRIBUTE_NAME", value:"Attribute Name",index:1}, {key:"TH_API_NAME", value:"API Name",index:2}, {key:"TH_ATTR_NUM", value:"Attribute Number",index:3}, ]; oAttTable.Columns = _headers; oAttTable.sort = "TH_ATTRIBUTE_NAME"; for (var i in allowedobjtypes){ var attrtypenums = oFilter.AttrTypes(Constants.CID_OBJDEF, allowedobjtypes[i]); for (var j in attrtypenums){ var oName = oFilter.AttrTypeName(attrtypenums[j]); var oApiName = oFilter.getAPIName(Constants.CID_ATTRDEF, attrtypenums[j]); if(oApiName.indexOf("AT_") != -1){continue;} var oDataRow = [ {key:"TH_ATTRIBUTE_NAME",value:oName}, {key:"TH_API_NAME",value:oApiName}, {key:"TH_ATTR_NUM",value:attrtypenums[j]} ] oAttTable.AddRow(oDataRow); } } var oReport = new oCargillExcel.Report("List of Attributes"); oReport.Table = oAttTable; oReport.Table.RemoveDuplicates("TH_ATTRIBUTE_NAME"); oReport.Write(oReport.Table.sort); oCargillExcel.WorkBook.write();