Profile picture for user MWZ

Based on our report with output of models and objects we now want to create a report which writes these information into a table.

This table should look like this:

Model name Object name
<Name of model 1>
  <Name of object 1>
  <Name of object 2>
  <...>
<Name of model 2>  
  <Name of object 1>
  <Name of object 2>
  <...>
<...>  

With table output it is also possible to generate output to Excel. So we add this format at the context of this report:

The only difference to generate table output is using different methods of the output object. All other methods like getting models or objects or reading their names are the same.

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", 50, "Arial", 10, Constants.C_BLACK, Constants.C_LIGHT_YELLOW, 0, Constants.FMT_BOLD | Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
oOutput.TableCell("Object name", 50, "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

    oOutput.TableRow();    
    oOutput.TableCell(sModelName, 50, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
    oOutput.TableCell("", 50, "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[i];              // Current object definition
        var sObjName = oObjDef.Name(nLocale);   // Name of current object
        
        oOutput.TableRow();    
        oOutput.TableCell("", 50, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
        oOutput.TableCell(sObjName, 50, "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();

To generate a table you have to use methods “BeginTable()” resp. “EndTable()” to open or close the table for writing. When you write into the table you have to start a new row using method “TableRow()” and finally you write the information into the current table cell with method “TableCell()”.

Here you can download the entire source code from the "Output models as table" report.

Note: This article describe how to develop a report in ARIS. See this post for links to similar articles.

by Shankar Ganesh
Posted on Wed, 05/12/2010 - 16:54

Thanks Michael.. Appreciate you & Volker on these Report Script Tutorials.

Just wanted to point out a correction in the Line-20 of this report code, where it should be "j" and not "i"

var oObjDef = aObjDefs[j];     // Current object definition

Note for Sebastian -- I tried typing as well as pasting the above code in the code editor but it resulted in below error. You may want to have it looked into:Line: 16
Char: 1338
Error: Invalid argument
Code:0
URL: http://www.ariscommunity.com/users/mwz/2010-05-11-output-models-table

0
by Sebastian Stein
Posted on Wed, 05/12/2010 - 17:15

Hi Shankar,

I think you just pasted it directly in the editor and not in the dialog appearing after pressing the "code" button in the toolbar. Can you confirm?

var oObjDef = aObjDefs[j];     // Current object definition 
0
by Shankar Ganesh
Posted on Wed, 05/12/2010 - 17:35

No Sebastian -- I had tried typing as well as pasting within the code snippet dialog. I tried again as part of this reply but still getting the same error.

0
by Sebastian Stein
Posted on Wed, 05/12/2010 - 18:58

What browser and which version are you using?

0
by Shankar Ganesh
Posted on Thu, 05/13/2010 - 06:57

IE v 7.0.5730.13

As an aside, Sebastian -- Should these posting around the code snippet dialog issue be moved to your post "Embedding ARIS code in your posts or comments"... rather than remaining on this post?

0
by Sebastian Stein
Posted on Fri, 05/14/2010 - 08:55

Hi Shankar,

IE7 was tested and worked here (tm). Hhhm, not sure what is going wrong in your case. Do you got some kind of script blocker installed or other stuff preventing scripts from executing?

About moving comments: Unfortunately, we can't move comments between posts easily, so we leave them here :-)

0
by ravi kiran
Posted on Wed, 07/20/2011 - 11:28

how to place the text

 

0
by Prasad Bramhe
Posted on Thu, 07/21/2011 - 14:58

Hi Sebastian

Pls make the correction in line 16 i.e.instead of i there is j.

0

Featured achievement

Question Solver
Share your expertise and have your answer accepted as best reply.
Recent Unlocks
  • CP
  • BZ
  • Profile picture for user TEF_Bernd
  • ПЦ
  • CR
  • PacMan

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock