Profile picture for user Krishna Kawade

Hello every one i'm new to ARIS I have to print function tree object with different level in Excel file with the help of script.I have attached my model and output file that i have reqired.Thanks in advance.

by Ralf Angeli
Posted on Thu, 10/28/2021 - 16:45

The following code should work. Put it in a report and set the context of the report to the Function Tree model type. Output should be Excel.

var g_nLoc = Context.getSelectedLanguage();
var g_oOutfile = Context.createOutputObject();

// Define style
g_oOutfile.DefineF("Standard", "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0, 0, 0, 0, 0, 0);

function main()
{   
    var aoObjOccs = ArisData.getSelectedModels()[0].ObjOccList();
    if (aoObjOccs.length > 0) {
        // Determine root objects
        var aoRoots = [];
        for (var i=0; i<aoObjOccs.length; i++) {
            var oObjOcc = aoObjOccs[i];
            if (oObjOcc.InEdges(Constants.EDGES_ALL).length == 0)
                aoRoots.push(oObjOcc);
        }
        // Determine table width and write header (10 columns hardcoded)
        var anColumns = [];
        for (var i=0; i<10; i++)
            anColumns.push(10.0);
        g_oOutfile.BeginTable(100, anColumns, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0);
        g_oOutfile.TableRow();
        for (var i=1; i<=10; i++)
            g_oOutfile.TableCellF("Level "+i, 1, 1, "Standard");
        g_oOutfile.TableRow();
        // Write out the tree data
        for (var i=0; i<aoRoots.length; i++) {
            writeTree(aoRoots[i], 1, i>0);
        }
    }
    g_oOutfile.EndTable("", 100, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT, 0);
    g_oOutfile.WriteReport();
}

function writeTree(p_oRoot, p_nLevel, p_bNewlineAndIndent) {
    if (p_bNewlineAndIndent) {
        g_oOutfile.TableRow();
        for (var i=1; i<p_nLevel; i++)
            g_oOutfile.TableCellF("", 1, 1, "Standard");
    }
    // Insert the root's name
    g_oOutfile.TableCellF(p_oRoot.getObjDefName(-1), 1, 1, "Standard");
    // Get and insert the root's children
    var aoChildren = p_oRoot.getConnectedObjOccs(null, Constants.EDGES_OUT);
    for (var i=0; i<aoChildren.length; i++) {
        writeTree(aoChildren[i], p_nLevel+1, i>0);
    }
}

main();

 

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