IS

Hello!

I need to find way to get object or models which are chosen by user server-wide. For example, in report started from one database I need to use objects from another database. Standard method

Dialogs.BrowseArisItems ( String sTitle, String sDescription, String sServerName, int itemKind )

allows user to select item from another database. But! It returns string ID of item only, and there is no information about database and user's name, password, filter.

Do anybody knows other way to get this?

Thanks!

by Ilya Seletkov Author
Posted on Sat, 01/18/2014 - 18:28

I've found some workaround of this problem. 

1. Let user select database (name from list of names, ArisData.getDatabaseNames()).

2. Let user input login data (custom dialog).

3. Dialogs.openDatabase(Login data).

4. Dialogs.BrowsArisItems(), filter by database name.

But there is bug again. If this DB was not opened by user prior executing script, Dialogs.BrowsArisItems() will show root group of DB only, no sub groups, no models or objects. At the same time DB.RootGroup().Childs() returns all Childs normally, DB.FingGUID() also works properly.

0
by Ilya Seletkov Author
Posted on Tue, 01/28/2014 - 05:21

I've resolved last problem by writing custom "BrowsArisItems" dialog using Tree method. Looks not good enough, but I don't see other solution. Tree

As a result array of selected Items is returned.

//---------------------------------------------------------------------------------------
//Диалог предоставляет пользовател возможность выбора элементов в БД.
function DialogBrowseArisItems(sTitle, sDescription, nItemKind, nLoc, oDB, nOps)
{   
    if (!IsDefined(nOps))
        nOps = 0;
    this.nOps = nOps;
    if (!IsDefined(oDB))
        oDB = ArisData.getActiveDatabase();
    this.oDB = oDB;
    if (!IsDefined(nLoc))
        nLoc = this.oDB.getDbLanguage().LocaleId();
    this.nLoc = nLoc;
    if (nItemKind==Constants.CID_MODEL)
        this.bModels    = true;
    else
        this.bModel     = false;
    if (nItemKind==Constants.CID_OBJDEF)
        this.bObjDefs   = true;
    else
        this.bObjDefs   = false;
    this.getPages = function()
    {    
        var nS = 10;
        var nH = 400;
        var nW = 600;
        var sTextH = 15;
        var oTmpl = Dialogs.createNewDialogTemplate(nW,nH,sTitle);
        //Текст "Описание"
        oTmpl.Text(nS, nS, nW, sTextH, sDescription);  
        oTmpl.Tree(nS, nS+sTextH, nW, nH-nS-sTextH, "Tree", this.nOps);
        oTmpl.OKButton();
        //oTmplMain.HelpButton("Help1");
        oTmpl.CancelButton();
        return [oTmpl];
    }
    this.oTree = null;
    this.aItems = [];
    this.oMetamodel = ArisData.ActiveFilter();
    //-------------------------------------------
    //Рекурсивная функция для заполнения структуры
    //читает папки/модели/объекты в БД ARIS
    this.FillStructureReqursive = function(oGroup, oParent)
    {
        var oLV = new Object;
        
        //Сначала выводим все подпапки
        oLV.aItems = oGroup.Childs();
        for (var i=0; i<oLV.aItems.length; i++)
        {           
            this.oChildG = oLV.aItems[i];
            this.oChildE = this.oTree.addChild(oParent, this.oChildG.Name(this.nLoc), this.aItems.length);
            this.aItems.push(this.oChildG);
            this.FillStructureReqursive(this.oChildG, this.oChildE);    
        }
        delete oLV.aItems;
        //Выводим все модели
        if (this.bModels)
        {
            oLV.aItems = oGroup.ModelList()
            for (var i=0; i<oLV.aItems.length; i++)
            {
                
                this.oModel     = oLV.aItems[i];
                this.sName      = this.oModel.Name(this.nLoc)+"["+this.oMetamodel.ItemTypeName(Constants.CID_MODEL, this.oModel.TypeNum())+"]";
                this.oChildE    = this.oTree.addChild(oParent, this.sName, this.aItems.length);
                this.aItems.push(this.oModel);
            }
            delete oLV.aItems;
        }
        //Выводим все объекты
        if (this.bObjDefs)
        {
            oLV.aItems = oGroup.ObjDefList()
            for (var i=0; i<oLV.aItems.length; i++)
            {
                
                this.oObjDef    = oLV.aItems[i];
                this.sName      = this.oObjDef.Name(this.nLoc)+"["+this.oMetamodel.ItemTypeName(Constants.CID_OBJDEF, this.oObjDef.TypeNum())+"]";
                this.oChildE    = this.oTree.addChild(oParent, this.sName, this.aItems.length);
                this.aItems.push(this.oModel);
            }
            delete oLV.aItems;
        }
    }
    //-------------------------------------------
    //Функия создаёт список БД и предлагает пользователю выбрать 
    this.FillStructure = function()
    {
        var oRoot = this.oDB.RootGroup();
        var oParent = this.oTree.addChild(null, oRoot.Name(this.nLoc), this.aItems.length);
        this.aItems.push(this.oRoot);
        this.FillStructureReqursive(oRoot, oParent);
    }
    //-------------------------------------------
    this.init = function(aPages)
    {   
        this.oTree = this.dialog.getPage(0).getDialogElement("Tree");
        this.FillStructure();
        return;
    }
    //-------------------------------------------
    this.isInValidState = function(pageNumber)
    { 
       var a = this.oTree.getSelection();
       if (IsDefined(a))
       if (a.length>0)
           return true;
       return false;
    }
    //-------------------------------------------
    this.canFinish = function(pageNumber)
    {
        var a = this.oTree.getSelection();
        if (IsDefined(a))
        if (a.length>0)
            return true;
        return false;
    }
    //-------------------------------------------
    this.canChangePage = function(pageNumber)
    {
        return true;
    }
    //-------------------------------------------
    this.ret=0;
    this.onClose = function(pageNumber, bOk)
    {
        if (bOk)
            this.ret=0;
        else this.ret=1;
    }
    
    this.getResult = function()
    {
        if (!this.ret)
        {
            var aSelection = this.dialog.getPage(0).getDialogElement("Tree").getSelection();
            if (!IsDefined(aSelection))
                aSelection = [];
            var ret = [];
            for (var i=0; i<aSelection.length; i++)
            {
                ret.push(this.aItems[aSelection[i]]);
            }
            delete this.aItems;
            return ret;
        }
        else
        {
            delete this.aItems;
            return [];
        }
    }
    return;
} 

is in ARIS from 7.2.4. 

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