RD

Hello All ,

Referring to the below ARIS Code , i trying to find the specific models from database and moving to another folder on the same database . When iam executing this script on particular group to get these models, this code its providing me the models from all groups . Example : A, B, C and D are groups in my database and trying to execute this code on group A to get specific models . But its taking all these specific models from all these four groups . Actually its should have taken from A group only . Pleaseverify the attached code and do the needful if any changes required to get desired output .

*************************************
Code updated below
***************************************

var g_nLoc = 1033;

var g_oOutfile = null;

function main(){
var oCurrentDatabase=ArisData.getActiveDatabase().ActiveFilter();
var oAllICDsOfTheDatabase=new Array();
var searchItem2 = oCurrentDatabase.createSearchItem(Constants.AT_NAME,g_nLoc,"*NGU",Constants.SEARCH_CMP_EQUAL, true, true);
var oAllICDsOfTheDatabase=oCurrentDatabase.Find(Constants.SEARCH_MODEL,null,searchItem2);

Regards,
Rams.

by Alberto Martins
Posted on Mon, 07/22/2013 - 15:28

In You code You are executing the find in the Context of the Selected DataBase and not in the Context of the Selected Group .

to be able to find in the Selected Group you must do the find in the speciofic Group, You can catch it by executing "ArisData.getSelectedGroups()"

 

dont't forget that the Report execution must be started from the Group where are located the Models You want to move.

 

 

0
by ramesh danda Author
Posted on Mon, 07/22/2013 - 15:38

In reply to by yubhesh

HI Alberto ,

Thanks for your inputs .

I had repalced in my code with "ArisData.getSelectedGroups()" and executed same . Its giving the error can not find function .

Can you pelase verify the below code and suggest if iam doing wrong

Updated Code .
**************************************************************************************************************
var oCurrentDatabase=ArisData.getSelectedGroups();
var oAllICDsOfTheDatabase=new Array();
var searchItem2 = oCurrentDatabase.createSearchItem(Constants.AT_NAME,g_nLoc,"*NGU",Constants.SEARCH_CMP_EQUAL, true, true)//case sensitive, all
var oAllICDsOfTheDatabase=oCurrentDatabase.Find(Constants.SEARCH_MODEL,null,searchItem2);
***************************************************************************************************************************

0
by Alberto Martins
Posted on Mon, 07/22/2013 - 16:10

You are doing several things not rigth

 

**************************************************************************************************************

var oCurrentDatabase = ArisData.getActiveDataBase();
//You will recive one or More Groups var arrSelectedGroups = ArisData.getSelectedGroups(); var arrList_Of_All_Models_In_Selected_Groups =new Array(); var searchItem2 = oCurrentDatabase.createSearchItem(Constants.AT_NAME,g_nLoc,"*NGU",Constants.SEARCH_CMP_EQUAL, true, true); for(var iIndex = 0; iIndex < arrSelectedGroups.length; iIndex ++){ var arrList_Of_Model_In_Group = arrSelectedGroups[iIndex].ModlList(false, <>,searchItem2); if(arrList_Of_Model_In_Group.length != 0){ arrList_Of_All_Models_In_Selected_Groups.concat(arrList_Of_Model_In_Group) } arrList_Of_Model_In_Group = null; } //loop for all Existing Models in all selected Groups that match Your critéria for(var iIndex = 0; iIndex < arrList_Of_All_Models_In_Selected_Groups.length; iIndex ++){ arrList_Of_All_Models_In_Selected_Groups[iIndex].Name(1033); }

 

***************************************************************************************************************************

 

0
by Alberto Martins
Posted on Mon, 07/22/2013 - 16:17

var oCurrentDatabase = ArisData.getActiveDataBase();

//You will recive one or More Groups

var arrSelectedGroups = ArisData.getSelectedGroups();

var arrList_Of_All_Models_In_Selected_Groups =new Array();

var searchItem2 = oCurrentDatabase.createSearchItem(Constants.AT_NAME,g_nLoc,"*NGU",Constants.SEARCH_CMP_EQUAL, true, true);

for(var iIndex = 0; iIndex < arrSelectedGroups.length; iIndex ++)

{

var arrList_Of_Model_In_Group = arrSelectedGroups[iIndex].ModlList(false, <<model are="" finding="" type="" you="">>,searchItem2); 

if(arrList_Of_Model_In_Group.length != 0)

  { 

    arrList_Of_All_Models_In_Selected_Groups.concat(arrList_Of_Model_In_Group)

  }

 arrList_Of_Model_In_Group = null;

}

//loop for all Existing Models in all selected Groups that match Your critéria

for(var iIndex = 0; iIndex < arrList_Of_All_Models_In_Selected_Groups.length; iIndex ++)

 {

  var sModelName =  arrList_Of_All_Models_In_Selected_Groups[iIndex].Name(1033);

}

0
by ramesh danda Author
Posted on Tue, 07/23/2013 - 08:53

In reply to by amoghal

Hi Alberto ,

Thank you so much your ínputs .

arrList_Of_Model_In_Group = arrSelectedGroups[iIndex].ModlList(false, >,searchItem2);

Here iam using the Constants.ARISVIEW_ALL for search the models from the group , and its giving me the Type error : Cannot find function model list in object group .

var arrList_Of_Model_In_Group = arrSelectedGroups[iIndex].ModlList(false,Constants.ARISVIEW_ALL,searchItem2);

Could you pelase help me on this ,

Regards,
Rams.

0
by Alberto Martins
Posted on Tue, 07/23/2013 - 12:19

Code that works

var oCurrentDatabase = ArisData.getActiveDatabase();
var g_nLoc = Context.getSelectedLanguage();
var arrSelectedGroups = ArisData.getSelectedGroups();
var arrList_Of_All_Models_In_Selected_Groups =new Array();
var searchItem2 = oCurrentDatabase.createSearchItem(Constants.AT_NAME,g_nLoc,"*NGU",Constants.SEARCH_CMP_EQUAL, true, true);
for(var iIndex = 0; iIndex < arrSelectedGroups.length; iIndex ++){
    var arrList_Of_Model_In_Group = arrSelectedGroups[iIndex].ModelList(false, null,searchItem2); 
    if(arrList_Of_Model_In_Group.length != 0){ 
        arrList_Of_All_Models_In_Selected_Groups = arrList_Of_All_Models_In_Selected_Groups.concat(arrList_Of_Model_In_Group);
    }
    arrList_Of_Model_In_Group = null;
}
//loop for all Existing Models in all selected Groups that match Your critéria
if(arrList_Of_All_Models_In_Selected_Groups.length != 0){
    for(var iIndex = 0; iIndex < arrList_Of_All_Models_In_Selected_Groups.length; iIndex ++){
        Dialogs.MsgBox(arrList_Of_All_Models_In_Selected_Groups[iIndex].Name(g_nLoc));
    }
}
else{
   Dialogs.MsgBox("No Model located in Selected Groups");
}
searchItem2 = null;
arrList_Of_All_Models_In_Selected_Groups = null;
arrSelectedGroups = null
oCurrentDatabase = null
0
by ramesh danda Author
Posted on Wed, 07/24/2013 - 09:13

Hi Alberto ,

Thank you so much for your support so far ..

I had excuted above script and getting syntax error : can not find the find the Modellist function on this line of code .

var arrList_Of_Model_In_Group = arrSelectedGroups[iIndex].ModelList(false, null,searchItem2);

Do i need to replace with any string behalf of "null" .

Can you please check and help on this .

Thnaks in Advance .

Regards,
Rams.

0
by Alberto Martins
Posted on Wed, 07/24/2013 - 13:59

Where did You started You report?

the Report Context is Group ? Correct? only by doing so we can get the available Groups

In the Report definition while choosing Context, You chould only have the Groups CheckBox selected.

You can add an extra validation to check if You have any Group selected

var oCurrentDatabase = ArisData.getActiveDatabase();
var g_nLoc = Context.getSelectedLanguage();
var arrSelectedGroups = ArisData.getSelectedGroups();
var arrList_Of_All_Models_In_Selected_Groups =new Array();
var searchItem2 = oCurrentDatabase.createSearchItem(Constants.AT_NAME,g_nLoc,"*a*",Constants.SEARCH_CMP_EQUAL, true, true);
if(arrSelectedGroups.length != 0){
    for(var iIndex = 0; iIndex < arrSelectedGroups.length; iIndex ++){
        var arrList_Of_Model_In_Group = arrSelectedGroups[iIndex].ModelList(false, null,searchItem2); 
        if(arrList_Of_Model_In_Group.length != 0){ 
            arrList_Of_All_Models_In_Selected_Groups = arrList_Of_All_Models_In_Selected_Groups.concat(arrList_Of_Model_In_Group);
        }
        arrList_Of_Model_In_Group = null;
    }
    //loop for all Existing Models in all selected Groups that match Your critéria
    if(arrList_Of_All_Models_In_Selected_Groups.length != 0){
        for(var iIndex = 0; iIndex < arrList_Of_All_Models_In_Selected_Groups.length; iIndex ++){
            Dialogs.MsgBox(arrList_Of_All_Models_In_Selected_Groups[iIndex].Name(g_nLoc));
        }
    }
    else{
       Dialogs.MsgBox("No Model located in Selected Groups");
    }
}
else{
    Dialogs.MsgBox("No Groups Selected to Run Report");
}
searchItem2 = null;
arrList_Of_All_Models_In_Selected_Groups = null;
arrSelectedGroups = null
oCurrentDatabase = null
0
by ramesh danda Author
Posted on Thu, 07/25/2013 - 13:34

Hi Alberto ,

Thanks for your responce so far on this .

In the Report definition while choosing Context, i had slelcted the Groups CheckBox and model check box .

By referring to the your code we can select avilable groups from database , but in my case i need to select the specified models from the groups .

Example : A,B,C, and D are groups in my database and these groups have the models with name suffix*NGU . So finnally i want to fetch these specific models from the individual groups .

This report iam executing on Goups like A,B,C, and D to fectch these models ( Models Name suffix with NGU ).

Does this code will give me the desired results as mentioned above ..? Thanks.

Regards,
Rams .

0
by Toine Schijvenaars
Posted on Wed, 12/10/2014 - 21:29

In reply to by Alberto Martins

Is it possible to create search item on a date? For example if i want to search for models which are recently updated, I tried this one:

var searchItem2 = oCurrentDatabase.createSearchItem(Constants.AT_LAST_CHNG_2,g_nLoc,"12/01/2104", Constants.SEARCH_CMP_GREATER, false, false);   If i execute this search in this line   var arrList_Of_Model_In_Group = arrSelectedGroups[iIndex].ModelList(false, null,searchItem2);    I get an error message which says: NullPointerException

Regards,

Toine

0
by Alberto Martins
Posted on Thu, 07/25/2013 - 17:56

The meaning of Execution Context for the Report is Witch are the available Start Points for the Report Execution

So what this context are saying is "where do we want to launch" the report and NOT witch data we use to interact inside the Report

 

by other works:

If I choose Object in the Report Context, what I'm saying is: the Specific Report will be only available for users when the select the defined Objects in the Context (eavan if isnside the code we work with Database / Group / Models / ObjDef / ObjOCC, etc..)

 

So by setting the Report Execution Context = Group -> This Report will be only available to Users when they evaluate an selected Group (the report will not be available for other type of "Objects")

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