MT

The Group.ModelList() shows some odd behavior. It cannot find a model (by name) when the name ends like ' 2013-2'. Mind the blank! It does find the model when the number is preceded or followed by a non-numeric character (p.e. ' a2013-2). The Find function in the designer (explorer) shows the same behavior. But there you can escape the hyphen with a backslash. That does not work in a report script. The only solution seems to be to replace the '-' with a '?' (wildcard), but that leaves some room for unwanted results (not much, but still..).

The example below searches for the model in its own Group and only finds the model when the hyphen is replaced (the line with the replace uncommented). I used modelname '3D Xoffice v_ 2013-3' for my test. We are running ARIS 9.7 on JAVA 1.7.

Is this a genuine bug, or am I missing something?

Does anyone have a better solution?

------

var gLocale = Context.getSelectedLanguage();                                 
var currentDatabase = ArisData.getActiveDatabase();
var sourceModel = ArisData.getSelectedModels()[0];
function main() {
    var searchGroup =  sourceModel.Group();
    var modelName = sourceModel.Name(gLocale);
//    modelName = modelName.replace("-", "?");
    var searchArg = currentDatabase.createSearchItem(Constants.AT_NAME, gLocale, modelName, Constants.SEARCH_CMP_EQUAL, false, true);
    var findResult = searchGroup.ModelList(true, [sourceModel.TypeNum()], searchArg);
    if (findResult.length == 0) {
        Dialogs.MsgBox("The model " + modelName + " NOT found.");
    }
    else {
        Dialogs.MsgBox("The model " + modelName + " found.");
    }       
}
main();

Featured achievement

Guru
You blog more than you breathe, and your articles stand out: Create 20 more articles, receive very good feedback and stimulate conversations
Recent Unlocks

Leaderboard

Weekly | All-time
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