
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 Ahmed,
It's not possible to include links into your report. You can however include the link in your report, and open the link from your report. Note that you need to have access to that link to do so.
Best regards,
Edwin
Thank you for these tutorials. They have helped me gain an understanding of how scripts work. Is there a repository where all the methods (e.g. GetSelectedModels) and constants (e.g. AT_DESC) can be found?
hi michel really very thnks this code is very helpful .But i have a question
how we have to place attribute should then be placed in the model,
at the position under the heading.Please could you tell me how to add.I am the new of aris
thanks michel
hi michel
how to exhicute all attributes under model
could u tell me
thanks
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
Hi All,
I need to get the assignments to the models as shown above and then their attributes too.
I would be grateful for your help.
Thanks.
Please check the script help in the ARIS help. The object model is described in there.