Hello,
I've noticed that coding using custom attribute types can be a little tricky for different reasons:
- Even thoug they suppose to be static, I've noticed custom attribute type numbers can change over time for different reasons. This has a direct impact on you code.
- You have to keep those numbers defined as global variables in your code and keep them updated.
- When you are working on the scripting module, you always have to switch to Admin module in order to know the custom attribute type number.
- This same problem happens with custom object or model types.
Can anyone out there explain what is the best way to work with this kind of attributes?
Best regards
Hello Fernando,
Best method to work with user-defined attributes is to use the GUIDs which are unique and constant. Here is an example for macros:
var metamodel = Context.getArisMethod(); var attRef = metamodel.UserDefinedAttributeTypeNum("67e9d210-748a-11df-76b7-003005a85e34");
Basicly, you get the attribute type number by GUID. Hope this helps.
Best Regards,
Cezmi
Hi Fernando -
Cezmi is right that you need to change the GUID values according to the environment if you are creating the attribute types separately on each one.
The workaround for this is to create the attribute types on one environment (your localhost, for instance), export your filter with the new attribute types included in it, then import that filter onto your production server. By importing the filter, the attributes will have the same GUID values on both servers. This allows you to use them in your custom reports without having to change the GUID values.
- Ellen
Thank you, Cezmi for the example above.
I'm currently trying to work with user defined attributes in a report and somehow, I'm missing something.
For macros and transformations there's the method "getArisMethod()" within the global object "context" which gives me access to the ArisMetaModel class.
For reports an semantic checks, the method "getArisMethod()" does not exist and I can't find any other method that gives me access to the ArisMetaModel class - or maybe I'm looking in the wrong places.
Could somebody please give me a hint? Thanks a lot!