Quantcast
Channel: ARIS BPM Community - script
Viewing all articles
Browse latest Browse all 26

Solution-Find by GUID

$
0
0

I was looking for solution to search object/model/group by GUID in ARIS repository however could not find any. Well then realized by writing few lines of code it is easily possible to search in the repository by GUID.

Please find the script attached as zip file.

The script is run on database level only. When run it will ask for GUID.

 

When the GUID is found it will tell where the item is including what type of itema and where it is.

If not found it will come up witha message like this.

var g_nLoc=1033;
var db= ArisData.getActiveDatabase();
    
function main(){
    
    //Get the GUID
    var search_GUID=Dialogs.InputBox("Enter the GUID","Search by GUID","Enter the GUID value here");
    
   
    if(search_GUID!=null){
        //get the Item
        var Item_Found=db.FindGUID(search_GUID)
        
        if (Item_Found.IsValid()){
            var Item_Name       =Item_Found.Name(g_nLoc);
            var Item_Type       =Item_Found.KindNum();
            var Item_Type_Name  =getItemType(Item_Type);
            var Item_path       =getItemPath(Item_Found,Item_Type);             
            var msg_String=Item_Type_Name+" <"+Item_Name+"> is found with GUID value <"+search_GUID+">"+" in location <"+Item_path+">";
            
            Dialogs.MsgBox(msg_String);
            
        }
        else{
            Dialogs.MsgBox("Not found. Please enter a valid GUID value.");
        }
        
    }
    else{
        Dialogs.MsgBox("Please enter the GUID value.");
    }
    
}
//get the Item path
function getItemPath(searchItem,intItemType){
    
    if (intItemType==Constants.CID_OBJDEF){
        return searchItem.Group().Path(g_nLoc);
    }
    if (intItemType==Constants.CID_MODEL){
        return searchItem.Group().Path(g_nLoc);
    }
    if (intItemType==Constants.CID_GROUP){
        return searchItem.Path(g_nLoc);
    }
}
//get the Item type
function getItemType(intItemType){    
    
    if (intItemType==Constants.CID_OBJDEF){
        return "Object";
    }
    if (intItemType==Constants.CID_MODEL){
        return "Model";
    }
    if (intItemType==Constants.CID_GROUP){
        return "Group";
    }      
}

main();

 

AttachmentSize
Find by GUID.zip1.51 KB

Viewing all articles
Browse latest Browse all 26

Trending Articles