ARIS Day Switzerland (German)
Register
ARIS Process Mining in action - Live Demo
Register

View all
HO

Hello

I m trying to create an Aris Macro that insert a symbole based on a value of a model attribut.

I m getting the error : "Model not opened" : when i trie to insert the symbole in the model, 

but not in every case : with some models it works fine, other not. 

here is the code : 

var g = Context.getSelectedGroups();

var tabg = new Array();
tabg[0]=g[0];
//Dialogs.MsgBox(Explorer.getChildren (g[0], g[0].getItemKind( )));

getcc(g[0]);

function getcc(gr){
 var l = new Array();
if(gr!=undefined){
   l=Explorer.getChildren(gr,gr.getItemKind());
   
 
for(var i=0; i<=l.length; i++){
  nl=tabg.length;
 if(l[i]!=undefined){ tabg[nl]=l[i];
  // Dialogs.MsgBox(Explorer.getChildren ( g, g.getItemKind ( )));
 getcc(l[i]);}
}   
}}

var mod = new Array();
mod[0]=0;

for (j=0; j<=tabg.length; j++){
if(tabg[j]!=undefined){   var fff = Explorer.getChildren(tabg[j],Constants.CID_MODEL);
   for(c=0; c<=fff.length; c++){
   var nlj=mod.length;
   
  if(Explorer.getChildren(tabg[j],Constants.CID_MODEL)[c]!=undefined){ mod[nlj] = Explorer.getChildren(tabg[j],Constants.CID_MODEL)[c];}

}}}

//var obl = Context.getSelectedObjects();
for(m=1; m<=mod.length; m++){
if (mod[m]!=undefined){
  //  Dialogs.MsgBox("It: "+mod[m].getType ( ));
   if(mod[m].getType()=="65549"){
   Designer.openModel(mod[m], false, false, true);
   var op=false;
   for(var o=0; o<=Designer.getOpenModels().length;o++){
   if(Designer.getOpenModels ( )[o]==mod[m]){op=true;}}
       
   if(op==false){Designer.openModel(mod[m], false, false, true);}
// Dialogs.MsgBox(Designer.getAttribute ( mod[m], 461527, null ));
   //   if( Designer.getAttribute ( mod[m], 461527, null )==Context.getArisMethod().UserDefinedAttributeValueTypeNum ( "b4941451-12c7-11ef-50c6-005056ad4831", "b4a9711f-12c7-11ef-50c6-005056ad4831"))
      if( Designer.getAttribute ( mod[m], 461527, null )=="Approuvé")   
      {
          if(Designer.isOpen(mod[m])==false){ Designer.openModel(mod[m], false, false, true);}//ajout
    // var texoc= Designer.createTextOcc ( mod[m], 10, 10, "Approuvé", 0,false );
 var db= Context.getLoginInfo( Context.getSelectedGroups()[0] ).getDatabase();
 
      var odef=Designer.getObjDefByGUID (db, "4a241121-1433-11ef-438d-8f3c4ff26280" );
   Designer.createObjOcc ( mod[m], odef, 65871, java.awt.Point(0,0) );
         

    // Designer.setSize ( mod[m],texoc,java.awt.Dimension(500,500)  );
      }
  
     if( Designer.getAttribute ( mod[m], 461527, null )=="En traitement")
      {    //var texoc=Designer.createTextOcc ( mod[m], 10, 10, "En traitement", 0,false );
             //   Designer.setSize ( mod[m],texoc, java.awt.Dimension(500,500) );
             if(Designer.isOpen(mod[m])==false){ Designer.openModel(mod[m], false, false, true);}//ajout
              var db= Context.getLoginInfo( Context.getSelectedGroups()[0] ).getDatabase();
 
      var odef=Designer.getObjDefByGUID (db, "4a241121-1433-11ef-438d-8f3c4ff26280" );
   Designer.createObjOcc ( mod[m], odef, 65871, java.awt.Point(0,0) );
      }
 
 Designer.closeModel(mod[m]); //ajout
}

}
  
}
Dialogs.MsgBox("Opération terminée");

    

by Martin Schröder
Badge for 'Contributor' achievement
Posted on Wed, 06/19/2024 - 16:08

Hello Omar,

maybe this can help. Did you check if can write to the model? It could be a question of access rights or locking by another user.

Regards, Martin

0

Featured achievement

Genius
You like to help others solve their problems by answering questions.
Recent Unlocks
  • KF
  • KH
  • RG
  • Profile picture for user Vee_ARIS
  • Profile picture for user smarty
  • PacMan

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