Hi!
I am creating a script for making sure that the name of the model and one more attribute is always placed in the model, and at the same position.
But I can not find any functionality in the script API that will allow me to check wheter the attributes are already placed in the model. It seems to me like the report class AttrOcc (which would give me those functions) is only available for object attributes. Any one else who has had this problem, or solved it in any other way?
Greatful for any ideas!
Hi Jenny!
You're right that's tricky...but look at next example it may help you:
var textOccList = model.TextOccList(); //check if new AttrOcc is already available if ( !isAttrOccAvailable( textOccList, newAttrTypeNum ) ) { //not available then do something..... } function isAttrOccAvailable( textOccList, attrtypenum ) { for(var i = 0; i < textOccList.length; i++) { var textOcc = textOccList[i]; var attrOccList = textOcc.AttrOccList(); for( var p = 0; p < attrOccList.length; p++) { var attrOcc = attrOccList[p]; var attrTypeNum = attrOcc.AttrDef( Context.getSelectedLanguage() ).getValue(); if( attrTypeNum == attrtypenum ) { return true; } } } return false; }