DJ

I am attempting to get an array of object Occurrences on a model that are of certain types.  I have defined the types in an array.  However, the ObjOccListFilter only seems to allow one type, and not an array.  I'm not able to use the ObjDefListByTypes routine due to symbol types used later in the report.

Anyone have a nifty work-around, or am I missing something?

by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Wed, 06/08/2022 - 11:38

Hi,

try this one:

ObjOccListBySymbol ( int[] p_iSymbolNum )

Robert

0
by Harry Ratia
Posted on Wed, 06/08/2022 - 13:18

Just to check if I got this right:

The "int[]" needs to contain a list of symbol numbers. These numbers can be found in the Configuration view of ARIS Architect.

If you for instance want to include the symbols for Application system type, ARIS model and Artifact, then it would look like this:

ObjOccListBySymbol([33, 248, 1596]);

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Wed, 06/08/2022 - 13:48

Correct...   but take care that these numbers may change between ARIS servers...

0
by Dieter Jansen Author
Posted on Wed, 06/08/2022 - 14:08

Thanks very much!

To explain, I want to get the Object Occurrences of a set of type numbers defined in an array (Constants.OT_FUNC, etc.), irrespective of symbol type.  At a later stage in the loop I need to filter out a specific symbol type, which is why I need to work with the Object Occurrences, not definitions.  However, there is no ObjectOccListByType function, and the ObJectOccListFilter only allows for a single object type rather than a set.

I have managed to get it to work by hard-coding in the object types, but that's 2nd prize.

Dieter

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Wed, 06/08/2022 - 14:52

Ok, then use concat function for this:

oObjOccList = oModel.ObjOccListFilter(Constants.OT_FUNC);

oObjOccList = oObjOccList.concat(oModel.ObjOccListFilter(Constants.OT_EVT));

Robert

 

0
by Kay Fischbach
Posted on Thu, 06/30/2022 - 14:44

In reply to by Dieter Jansen

In case you ever run into a situation where you want to filter an array of object occurrences (e.g. the result of a previous filter operation) you can also define a filter function like

/**
* Filters an array of object occurrences with an array of object type numbers
* @param {ObjOcc[]} objOccsArr - an array of unfiltered object occurrences
* @param {ObjOcc[]} objTypeNumbersArr - an array of permitted object type numbers
* @return {ObjOcc[]} - the filter result
**/
function objOccListFilterMultipleTypes(objOccsArr, objTypeNumbersArr) {
    var typeNrFilterSet = new java.util.HashSet(); //using HashSet for O(1) constant lookup times
    for each (var objTypeNumber in objTypeNumbersArr) {
        typeNrFilterSet.add(objTypeNumber); //add the type numbers to HashSet
    }
    
    
    /**
    * Returns whether the type number of an occurrence exists in the previously defined typeNrFilterSet
    * @param {ObjOcc} someOcc - occ whose object type should be evaluated
    * @return {boolean} - true if the passed object occurrence has a permitted object type, otherwise false
    */
    function filterOccWithTypeNumFilterSet(someOcc) {
        return typeNrFilterSet.contains(someOcc.ObjDef().TypeNum());
    }
    
    return objOccsArr.filter(filterOccWithTypeNumFilterSet);
}

 

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