RB

Is there an existing report that will produce the model graphic and find assigned  models and produce their graphic as well? It looks like the Create Process Manual report should do it, I thought I had use it for this before, but I only get the selected model no matter how many assignment levels I enter.

by Eva Klein
Badge for 'Community Team' achievement
Posted on Wed, 03/02/2011 - 08:59

I'm not sure if there is an existing report which does exactly what you describe. But if I understand you in the correct way, you want to output the graphics of a model with all its assignments, right?

The tutorials "Output picture of model in Microsoft Excel" describes how to output a model graphic. If you add these lines to the reports:

var oFuncDefs = oModel.ObjDefListFilter(Constants.OT_FUNC);
        for (var k = 0; k < oFuncDefs.length; k++) {
            var oFuncDef = oFuncDefs[k];
            var oAssignedModels = oFuncDef.AssignedModels();
        
            for (var j = 0; j < oAssignedModels.length; j++) {
                var oAssModel = oAssignedModels[j];
                var sheet = workbook.createSheet(oAssModel.Name(g_nLoc));   
                pictureOfModel(oAssModel,sheet);
            }
        }

you will obtain the required output.

Below is the complete script code.

var g_nLoc = Context.getSelectedLanguage();
var models = ArisData.getSelectedModels();
var workbook = Context.createExcelWorkbook(Context.getSelectedFile());
var dummyOutput = Context.createOutputObject();

main();

dummyOutput.WriteReport() //otherwise it would overwrite the excel output!
workbook.write();
 
function main(){
    for(var i=0;i<models.length;i++){
        var oModel = models[i];
        var sheet = workbook.createSheet(oModel.Name(g_nLoc));   
        pictureOfModel(oModel,sheet);
        
        var oFuncDefs = oModel.ObjDefListFilter(Constants.OT_FUNC);
        for (var k = 0; k < oFuncDefs.length; k++) {
            var oFuncDef = oFuncDefs[k];
            var oAssignedModels = oFuncDef.AssignedModels();
        
            for (var j = 0; j < oAssignedModels.length; j++) {
                var oAssModel = oAssignedModels[j];
                var sheet = workbook.createSheet(oAssModel.Name(g_nLoc));   
                pictureOfModel(oAssModel,sheet);
            }
        }
    }
}

function pictureOfModel(oModel, sheet) {
    var pic = oModel.Graphic(false,false,g_nLoc);
    var sfileName = oModel.GUID() + ".png";
    var width = pic.getWidth(Constants.SIZE_PIXEL ) * 20 * (100.0/125.0) //twips, correction factor because of excel anomaly (X): * (100.0/125.0)
    var xCells = width / 1024;
    var xTwips = width % 1024;
    var height = pic.getHeight(Constants.SIZE_PIXEL ) * 20*(100.0/133.0) //twips, correction factor because of excel anomaly (Y): \*(100.0/133.0)*/
    var yCells = height / 256;
    var yTwips = height % 256;
    pic.setZoom(150) // image improvement only(optional)
    pic.Save(dummyOutput, sfileName);
    var data = Context.getFile(sfileName, Constants.LOCATION_OUTPUT);
 
    sheet.setPicture ( data, 0, 4, 0+xCells, 4+yCells, 0, 0, xTwips, yTwips);
    Context.deleteFile(sfileName);
}

Regards

Eva

 

 

 

0
by Tarun R Nath
Posted on Thu, 09/06/2012 - 04:20

Hi Eva,

I implemented you sctipt and it works completely fine. Need your help in 1 last thing, if you could guide me how to increase the depth level of assignements being captured in the excel. Right now, its picking only one level down. I would like the report to drill down futher assignments level like-

4

4.1

4.1.1

Hoping to hear from you soon..

Cheers,

Tarun R.

0
by Torsten Haase
Posted on Mon, 09/10/2012 - 17:13

Hi,

I've added a recursion to the script so you can define how many levels you want to export to the excel workbook.

 

BR,

Torsten

var g_nLoc = Context.getSelectedLanguage();
var models = ArisData.getSelectedModels();
var workbook = Context.createExcelWorkbook(Context.getSelectedFile());
var dummyOutput = Context.createOutputObject();

var MAXLEVEL = 2; //a maximum depth to reduce script runtime and sheet count :)
var setWrittenModels = new java.util.HashSet(); //avoid endless loops created by circular assignments
 
for(var i=0;i<models.length;i++){
    var oModel = models[i];
    createModelGraphicRecursive(oModel, 0, "1")
}
 
dummyOutput.WriteReport() //otherwise it would overwrite the excel output!
workbook.write();



function createModelGraphicRecursive(model, level, index)
{
    if(setWrittenModels.contains(model.GUID()))
        return false; // already visited
    
    if(level>MAXLEVEL)
        return false; // too deep
    
    setWrittenModels.add( model.GUID() )
    var sheet = workbook.createSheet(index +" "+model.Name(g_nLoc));  
    pictureOfModel(model,sheet);
         
    var oFuncDefs = model.ObjDefListFilter(Constants.OT_FUNC);
    var nFuncWithAssignment = 1;
    for (var k = 0; k < oFuncDefs.length; k++) {
        var oFuncDef = oFuncDefs[k];
        var oAssignedModels = oFuncDef.AssignedModels();
        
        for (var j = 0; j < oAssignedModels.length; j++)
        {    
            var oAssModel = oAssignedModels[j];
            if(createModelGraphicRecursive(oAssModel, level+1, index + "." + nFuncWithAssignment))
                nFuncWithAssignment++;  
        }
    }
    return true;
}
 
function pictureOfModel(oModel, sheet) {
    var pic = oModel.Graphic(false,false,g_nLoc);
    var sfileName = oModel.GUID() + ".png";
    var width = pic.getWidth(Constants.SIZE_PIXEL ) * 20 * (100.0/125.0) //twips, correction factor because of excel anomaly (X): * (100.0/125.0)
    var xCells = width / 1024;
    var xTwips = width % 1024;
    var height = pic.getHeight(Constants.SIZE_PIXEL ) * 20*(100.0/133.0) //twips, correction factor because of excel anomaly (Y): \*(100.0/133.0)*/
    var yCells = height / 256;
    var yTwips = height % 256;
    pic.setZoom(150) // image improvement only(optional)
    pic.Save(dummyOutput, sfileName);
    var data = Context.getFile(sfileName, Constants.LOCATION_OUTPUT);
  
    sheet.setPicture ( data, 0, 4, 0+xCells, 4+yCells, 0, 0, xTwips, yTwips);
    Context.deleteFile(sfileName);
}
0
by Simon Dannefaerd
Posted on Tue, 05/07/2019 - 23:21

Hi All, 

I know this may be a noob question but how can I do the same above but have the images display in a Word Doc instead?

Cheers

Sy

0
by Torsten Haase
Posted on Wed, 05/08/2019 - 09:27

Hi Simon,

this is exactly what the standard report "Create process manual" does. You can start it on a process model (EPC, BPMN, Value Added Chain,...) and specify the level of assignments to consider.

BR, Torsten

0
by Simon Dannefaerd
Posted on Wed, 05/08/2019 - 22:34

In reply to by thaase

I agree but my boss wanted to a report with only the models and nothing else, description/appendix etc etc , I have now gone through a copy of the Create Process Model and have done what they need.  Was hoping to find a nice clean way of doing this code.

But thanks for getting back to me!! Really appreciate it

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

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