Step 1 - Output model names
Based on our first “Hello ARIS” report we now want to generate an output document which contains ARIS content. Therefore we create a report which lists all selected models with their names and the names of the contained objects.
For using the selected models in your report you have to enter the following code line:
var aModels = ArisData.getSelectedModels();
And now you can iterate over these models and output their names.
To get the names we have to call method “Name()” with the language as parameter. To get this language we us the following code line:
var nLocale = Context.getSelectedLanguage(); // Selected database language
So the complete script looks as follows:
var oOutput = Context.createOutputObject(); // Output object var nLocale = Context.getSelectedLanguage(); // Selected database language 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 oOutput.OutputLn(sModelName, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); } oOutput.WriteReport();
Step 2 - Output model and object names
In a further step we want to add the names of all objects which are contained in our models.
To get the objects of the models we use the following method:
var aObjDefs = oModel.ObjDefList(); // All object definitions that have occurrences in the model
So that the report now looks like this:
var oOutput = Context.createOutputObject(); // Output object var nLocale = Context.getSelectedLanguage(); // Selected database language 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 oOutput.OutputLn("Model: " + sModelName, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 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[i]; // Current object definition var sObjName = oObjDef.Name(nLocale); // Name of current object oOutput.OutputLn("Object: " + sObjName, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 10); } } oOutput.WriteReport();
You can see: Getting names of objects works in the same way as getting names of models.
Here you can download the entire source code from the "Output models" report.
Note: This article describe how to develop a report in ARIS. See this post for links to similar articles.
Hello Mr. Wieczorek,
First off, thank you for this article, it has been very helpful to me.
I put this report in ARIS today, and while i was testing it i noticed one item. On line 24 of your source code (line 13 in the above picture), you have:
var sObjDef = aObjDefs[i];
When i ran the report with the line like this, it returned the same name for all of the objects on the model. It had the correct number of returned names, they were just all the same.
The line of code should be:
var sObjDef = aObjDefs[i++];
If this line is used, the report, when ran will return all of the correct object names.
Thank you!
Just realized that the problem is that the code bit was using a different index, though I don't know "how" it causes the error I stated. What it should do instead is to generate object names indexed on the same count "i," generating the same output throughout the inner loop. To the guy who replied before me, instead of "i," you should use "j".
Hi Nandita,
var oModel = aModels[i];
returns the current model.
For example: you choose two models (EPC1 and EPC2) then you first evaluate the EPC1 and then the EPC2. There is one error in the report, in this linevar oObjDef = aObjDefs[i];
you must change the "i" into "j".
Regards
Eva
Hi Eva,
Sorry I'm not understanding your instructions. After opening the main folder group in Explorer, how do I "choose a model to evalute". Double-clicking on a model opens it up in Designer. If I do this for multiple models, they are opened up in designer under different tabs.
Right-clicking Evalute - start report will only let me do this for one model, where am I going wrong?
Regards,
Hi Eva,
I have a doubt in designer module of ARIS .I want to change process id attribute across a group of models(say 200 models).Is there any simple method by which I can update them as a whole instead of going into each model and changing the attribute.
Regards,
Nandita
Dear Ahmad,
The above discussion is almost 7 years old. It refers to an ARIS version which you are probably not using. Except from that, your didn't provide sufficient information to respond with helpful tips.
I suggest you ask your question as new post along with information such as ARIS product + version, what you did, what you did expect to happen, and what happened instead.
Cheers
Rune
Hi,
First of all, I want to thank you for your articles. I searched a lot but didn't find any article or tutorial in the internet that teaches me like these ones.
Everything is fine, but when report is created, all objects of a model is written mixed, not sorted. Is there a way to write them in the order of their index or something?
Thanks a lot
Arda
Dear Arda,
You replied to a discussion which started years back. I suggest to ask your question as a new post into this forum, because then everyone can read it. And please provide more details of what you tried and what you expect to happen. At best with screenshots of sample data.
Cheers
Rune