![]() |
| Comments |

by Mr. Srinivas CH on Fri, 2012/05/18 - 1:06pm
Hi Ajay,
Please check the below script, it will display the attributes of an object, If you want to display the attributes of a model then change oObject to oModel.
var nLocale=Context.getSelectedLanguage();
function main(){
// creates an output object
var oOutput=Context.createOutputObject();
//Begining of a table
oOutput.BeginTable(100,Constants.C_DARK_BLUE, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0);
oOutput.TableRow();
oOutput.TableCell("Object Name",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
oOutput.TableCell("Identifier",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
oOutput.TableCell("Description",30,"Arial",10,Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
var models=ArisData.getSelectedModels();
for(var i=0;i<models.length;i++){
var oModel=models[i];
var objects=oModel.ObjDefList();
for(var j=0;j<objects.length;j++){
var oObject=objects[j];
var sobjectName = oObject.Name(nLocale);
var sobjectID = getAttributeValue(oObject,Constants.AT_ID);
var sobjectDesc = getAttributeValue(oObject,Constants.AT_DESC);
oOutput.TableRow();
oOutput.TableCell(sobjectName,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
oOutput.TableCell(sobjectID,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
oOutput.TableCell(sobjectDesc,30,"Arial",10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
}
}
oOutput.EndTable("",100,"Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
oOutput.WriteReport();
function getAttributeValue(oItem,nAttrType){
var oAttr=oItem.Attribute(nAttrType,nLocale);
var sAttrValue=oAttr.getValue();
return sAttrValue;
}
}
main();
BR/Srinivas.
- Login or register to post comments

by Dr. Sebastian Stein on Fri, 2012/05/18 - 2:23pm
Another is the WYSIWYG report editor. It should be easy to iterate a list of models/objects and output just those attributes you need. In the help section of ARIS Community, you find several tutorials on using the WYSIWYG editor.

