Profile picture for user njadas

Hi all,

I am trying to sort a definition objects array using the sort method, as below.

oObjDefs = ArisData.sort(oObjDefs, Constants.SORT_TYPE, Constants.AT_NAME, Constants.SORT_NONE, g_nLoc); 

The required sort is by Type, Name, Symbol Num. For Type and Name its working ok. I kindly need to know what constant I need to use for the Symbol Number attribute (is there any?).

 

Regards,

Nicola 

by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 05/02/2023 - 09:27

Hi,

you cannot sort object definitions by symbols, because the symbols are part of the properties of the occurrences. So an object definition may have multiple occurrences with different symbols.

You could use the default symbol, but this must not always be the same as the symbol the object occurrences (even if only a single one) have - so I would not use this. And there is afaik no sort method for the default symbol.

If you want to sort it, I would go through the list and add the objects to different arrays per default symbol (if you know beforehand which symbols there will be) OR I would use a java map with the key the default symbol type and the value an array of found objects...

BR Robert

0
by Nicola Adas Author
Posted on Wed, 05/03/2023 - 11:36

Thanks Robert for the info. I'll use the separate array option as you mentioned.

0
by Kay Fischbach
Posted on Wed, 05/03/2023 - 12:25

In reply to by njadas

If you just need them sorted by default symbol number without any custom ordering, you can simply define your own javascript function by which the Javascript array.sort method should sort the object definitions.

Example:

var nLocale = Context.getSelectedLanguage();

var selGroup = ArisData.getSelectedGroups()[0];

var allObjDef = selGroup.ObjDefList();

function sortObjDefs(objDefA, objDefB) {
    var result = objDefA.getDefaultSymbolNum() - objDefB.getDefaultSymbolNum();
    
    if(result == 0) { //if same default symbol
        result = objDefA.Name(nLocale).localeCompare(objDefB.Name(nLocale)); //sort by name of object definition
    }
    
    return result;
}

var sortedObjDefs = allObjDef.sort(sortObjDefs);

 

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