Profile picture for user pedropablo

Does anybody have an example of a script where find the "function" objects in an EPC and assign them a "ID" attribute according to their order in the EPC?

by Shashi Pal
Posted on Thu, 03/27/2014 - 13:56
var omodel=ArisData.getSelectedModels();
var gloc=Context.getSelectedLanguage();

function main(){
    for(var i=0;i<omodel.length;i++){
        var objOccList=omodel[i].ObjOccListBySymbol(335);
        var sortedObjOccList=objOccList.sort(sortObjOccByPosition);
        for(var j=0;j<sortedObjOccList.length;j++){
            //provide the id which u want to assign for id attribute 
            //updating the id attribute by 0,1,2.....
            sortedObjOccList[j].ObjDef().Attribute(Constants.AT_ID,gloc).setValue(j);
        }
    }
}
main(); 

function sortObjOccByPosition(a,b){
    if( a.Y() < b.Y() )   return -1;
    if( (a.Y() == b.Y()) && (a.X() < b.X()) ) return 1;
    if( (a.Y() == b.Y()) && (a.X() > b.X()) ) return -1;
    if( a.Y() > b.Y() )   return 1;
    
    return 0;
}

 

0
by Torsten Haase
Posted on Fri, 03/28/2014 - 15:00
var modelList=ArisData.getSelectedModels();

for(m in modelList)
    DFSindex(modelList[m], Context.getSelectedLanguage())

function DFSindex(model, locale)
{
    var index = 0;
    var used = new java.util.HashSet()
    
    model.BuildGraph(true)
    var startOccList = ArisData.sort( model.StartNodeList(), Constants.SORT_Y, Constants.SORT_X, locale)
    for(i in startOccList)
    {
        var occ = model.DFSGetFirstNode(startOccList[i])
        while(occ!=null && occ.IsValid())
        {
            if(occ.getSymbol()==Constants.ST_FUNC && !used.contains(occ.ObjectID()) )
            {
                occ.ObjDef().Attribute(Constants.AT_ID,locale).setValue("index " + index);
                used.add(occ.ObjectID())
                index++;
            }
            occ = model.DFSNextNode() 
        }
    }
}

 

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