KK

Hi,

i am new to ARIS script I have written the below code , i need to check Connection type like Any function or activity connected to org unit and internal person has connection type "is responsible for"

or" is accountable for", this is my code i am stuck can any body suggest 

function Rule_867a0260_5760_11e8_44b4_0050568d644b(selection, ruleID, unused, outputObject)

{

         

     var selModel = selection;

       

  

     for(var i=0;i<selModel.length;i++){

     var config = getConfiguration("2cb291d0-575f-11e8-44b4-0050568d644b");

        

    var objocc = selModel[i].ObjOccList();

  

    for(var j=0;j<objocc.length;j++){ 

        

        var check = objocc[j].ObjDef().CxnList(Constants.EDGES_INOUT)

         

         }  

        for (var k =0;k<check.length;K++){

        var conn = check[k].TypeNum();

        

        

    if(conn =="462" == 0){

        Dialogs.MsgBox("code is working")

      setSemCheckInfoMark(objocc[j],"Connection type error");

    }

}}

}

by Kay Fischbach
Posted on Thu, 05/24/2018 - 13:12

Are your Activity/Function, Org unit and Internal person in the same model, the model on which you execute the report? I'm assuming yes (you really should specify a model type when you ask for such help, it would make helping you much easier). If this isn't the case, or only partly the case, feel free to tell me.

Here's an idea

<pre class="brush: jscript">

var p_selModels = ArisData.getSelectedModels();

function main(){

    for each (var selModel in p_selModels){

        var p_objOcc = selModel.ObjOccListBySymbol([Constants.ST_FUNC]); //Here, after a comma after Constants.ST_FUNC, add the Symbol Number of your Activity symbols

       

        for each (var objOcc in p_objOcc){

            var isAcceptable = true; //Instead of trying to prove your Function/Activity is acceptable, we assume it is acceptable and try to prove it is unacceptable for whatever specified reason

           

            //Check if connected with Organizational unit

            if(objOcc.getConnectedObjOccs(Constants.ST_ORG_UNIT_1).length == 0){

                isAcceptable = false;

            };

           

            //Check if connected with Interal Person with the connection type being "is responsible for" or "is accountable for"

            var p_cxnOcc = objOcc.Cxns();

            for each (var cxnOcc in p_cxnOcc){

                if(!(((cxnOcc.getDefinition().TypeNum() == Constants.SMTH) || (cxnOcc.getDefinition().TypeNum() == Constants.SMTH)) && (cxnOcc.SourceObjOcc().SymbolNum() == Constants.ST_PERS_INT))){ //IMPORTANT: In this line, where it says Constants.SMTH, you must somehow put the connection Type number here.

                    isAcceptable = false;

                }

            }

           

            if(isAcceptable) {

                Dialogs.MsgBox("Yes");

            } else {

                Dialogs.MsgBox("No");

            }

        }

    }

}

</pre>

You can certainly NOT copy my code 1:1 into your semantic check and it works, it was never even designed for semantic checks, this is just to show you the structure that I would follow. Maybe you can take a few ideas from them and make your semantic check work.

If you have any questions, feel free to ask, I'm trying to become become a better ARISscript developer myself.

Edit: I can not get this "Synthax highlight code" thing to work, I hope you can read it anyways.

0
by Kaushal Kishor Author
Posted on Fri, 05/25/2018 - 13:20

Many thanks for all your help.. This really helped .. :)

I am able to complete coding for my requirement :):)

0
by Kay Fischbach
Posted on Fri, 05/25/2018 - 14:57

Just one advise for the future. Before you code anything, create a plan, where you write down your path of progression.

There are many different ways you can take from one object, like from an object occurrence you can take the model in which it occurs, take the group of that model, and look for object definitions in that group. Or you can go from the object occurrence to the corresponding object definition, and look for all object occurrences of that object definition.

Having a plan, and therefore a clear picture of what you want to achieve, is essential for ARIS script development (and basically for every other task that has something to do with programming). Keep that in mind, and never just "get to it".

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