Much content in ARIS is stored in different attributes. Therefore we want to add further column rows which contains values of the attributes “Identifier” and “Description”:
Model name |
Object name |
Identifier |
Description |
<Name of model 1> |
|
<ID of model 1> |
<Desc. of model 1> |
|
<Name of object 1> |
<ID of object 1> |
<Desc. of object 1> |
|
<Name of object 2> |
<ID of object 2> |
<Desc. of object 2> |
|
<…> |
<…> |
<…> |
<Name of model 2> |
|
<ID of model 2> |
<Desc. of model 2> |
|
<Name of object 1> |
<ID of object 1> |
<Desc. of object 1> |
|
<Name of object 2> |
<ID of object 2> |
<Desc. of object 2> |
|
<…> |
<…> |
<…> |
<…> |
|
<…> |
<…> |
Therefore we first write this function to read the attribute value:
function getAttributeValue(oItem, nAttrType) { var oAttr = oItem.Attribute(nAttrType, nLocale); // Attribute with the specified type number in the specified language var sAttrValue = oAttr.getValue(); // Content of the attribute return sAttrValue; }
With method “Attribute()” and the parameters attribute type number and language we get the attribute object and with method “getValue()” of this attribute we get the maintained value.
In the report we use this method as follows:
var sModelID = getAttributeValue(oModel, Constants.AT_ID); // ID of current model var sModelDesc = getAttributeValue(oModel, Constants.AT_DESC); // Description of current model
Our complete script now looks like this:
var oOutput = Context.createOutputObject(); // Output object var nLocale = Context.getSelectedLanguage(); // Selected database language oOutput.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); oOutput.TableRow(); oOutput.TableCell("Model name", 25, "Arial", 10, Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("Object name", 25, "Arial", 10, Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("Identifier", 25, "Arial", 10, Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("Description", 25, "Arial", 10, Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0); var aModels = ArisData.getSelectedModels(); // Array of selected models for (var i = 0; i < aModels.length; i++) { var oModel = aModels[i]; // Current model var sModelName = oModel.Name(nLocale); // Name of current model var sModelID = getAttributeValue(oModel, Constants.AT_ID); // ID of current model var sModelDesc = getAttributeValue(oModel, Constants.AT_DESC); // Description of current model oOutput.TableRow(); oOutput.TableCell(sModelName, 25, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell("", 25, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sModelID, 25, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sModelDesc, 25, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); var aObjDefs = oModel.ObjDefList(); // All object definitions that have occurrences in the model for (var j = 0; j < aObjDefs.length; j++) { var oObjDef = aObjDefs[j]; // Current object definition var sObjName = oObjDef.Name(nLocale); // Name of current object var sObjID = getAttributeValue(oObjDef, Constants.AT_ID); // ID of current object var sObjDesc = getAttributeValue(oObjDef, Constants.AT_DESC); // Description of current object oOutput.TableRow(); oOutput.TableCell("", 25, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sObjName, 25, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sObjID, 25, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0); oOutput.TableCell(sObjDesc, 25, "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); // Attribute with the specified type number in the specified language var sAttrValue = oAttr.getValue(); // Content of the attribute return sAttrValue; }
Here you can download the entire source code from the "Output models with attributes" report.
Note: This article describe how to develop a report in ARIS. See this post for links to similar articles.
Too Nice Mr. Michael Wieczorek but i have a question
if i add to any object in my EPC Model link attribute thats connect with doc files and i hope to print thats doc in my report how can do it ?
thanks.
Regards Ahmed Alnasasrah
Hi Michael,
I’m trying to build a report for an EPC (row display) model.
I tried to add to the report above two additional field with no succeed.
1. Field stating if this row is an Organizational unit or Application System Type
2. The name of the Organizational Unit Application System Type objects.
Can you assist with this one?
Thanks in advance
Too Nice Mr. Michael Wieczorek
It's very help full to learn ARIS Script.
I want to use boarder on table.
Please suggest me how can I achieve that.