BR

Hi

I'd like to set the title of the report to be the selected subprocess name, if there is only one selected subprocess, or to be the process name, if there is more than one subprocess selected.  Is this possible?

At the moment the title of the report is set to be the script name, which I understand is the default.

Thank you in advance for your help.

Bruno Rocha

by Kay Fischbach
Posted on Thu, 08/20/2020 - 09:32

Hi, this is totally possible.

Here is how I would do it (note: this is crudely written - you may be able to improve it)

var nLocale = Context.getSelectedLanguage(); //get the Locale id

var modelsArray = ArisData.getSelectedModels(); //get the selected models

var futureFileName = null; //placeholder variable for the future script name

if (modelsArray.length == 1) { //if only one model has been selected
    futureFileName = modelsArray[0].Name(nLocale); //found the future file name (without file extension)
} else if (modelsArray.length > 1) { //else if multiple models have been selected, try to find the superior model that contains occ of objdef which have the sub processes assigend
    var potentialSuperiorModels = null; //placeholder for an array that'll contain multiple superior objects
    
    for each (var modelsArrayElement in modelsArray) { //go through all selected models
        if(potentialSuperiorModels == null) { //if it's the first model we're checking
            potentialSuperiorModels = getUniqueSuperiorModels(modelsArrayElement); //set the superiorModelsArray to the superior models of the current model
        } else { //otherwise
            potentialSuperiorModels = getUniqueIntersection(potentialSuperiorModels, getUniqueSuperiorModels(modelsArrayElement)); //get the intersection of all the models that contain the found superior models so far and the superior models of the current model
        }
    }
    
    if(potentialSuperiorModels != null && potentialSuperiorModels.length == 1){ //if only one superior model remains
        futureFileName = potentialSuperiorModels[0].Name(nLocale); //found the future file name (without file extension)
    }
    
}
if (futureFileName != null) { //if the future file name (without file extension) was found
    //set the future file name - don't forget to append the file format (e.g. .txt, .pdf, .doc)
    //you can implement this yourself
}

function getUniqueSuperiorModels(model) { //function to find the superior models of a model
    var resultArray = [];
    
    for each (var superiorObjDef in model.getSuperiorObjDefs()) {
        for each(var superiorObjDefOcc in superiorObjDef.OccList()) {
            resultArray.push(superiorObjDefOcc.Model());
        }
    }
    
    return ArisData.Unique(resultArray);
}

function getUniqueIntersection(arrayA, arrayB){ //find the intersection of two arrays containing elements of the Aris class Item - in this script it's only used for objects of the type Model, which inherits from Item the IsEqual method
    var resultArray = [];
    
    arrayAIteration:
    for each (var arrayAElement in arrayA) {
        for each(var arrayBElement in arrayB) {
            if(arrayAElement.IsEqual(arrayBElement)) {
                resultArray.push(arrayAElement);
                continue arrayAIteration;
            }
        }
    }
    
    return ArisData.Unique(resultArray);
}

If you have any questions about the script or how to approach such a problem in general, feel free to ask. I added comments to most of the lines of the script, trying to explain what it does in English.

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