NF

Hi everyone,

Is there a simple way to get all types of objects (objects that I already store in "objdefs") and show them in checkboxes ? (I don't want to use a listbox because I need to let the user have a multiple choice).

how I store my objects :

 var loc = Context.getSelectedLanguage();
 var group = ArisData.getSelectedGroups()[0]; 
        
  //stocker tous les modèles
    var grpMdls = ArisData.getSelectedGroups()[0].ModelList(true);
    
  //récupérer tous les objets des modèles
    var objdefs = new Array();
    for(var i = 0; i < grpMdls.length; i++){
    objdefs = objdefs.concat(grpMdls[i].ObjDefList());
    }

Thank you in advance ! 

 

by Kay Fischbach
Posted on Mon, 09/28/2020 - 13:02

Hi

may I ask what's wrong with giving the user a ListBox for multiple choice?

While it does not support multiple choice by default, if your last parameter is 1 (supports multi-select) or 2 (sorted + supports multi-select) users will be able to select multiple items. Controls are similar to what you'd find in a file explorer - hold ctrl and click on entries to toggle their individual selection, or click on one item, hold shift and click on another item to select a range of items (first clicked item + last clicked item + everything in between).

iDialogTemplate1.ListBox(10, 20, 100, 80, objDefStringNameArray, "LISTBOX_1", 1);

***

How to get the Object defs actually into the list? Don't think there is a way other than creating a string array with the object def names. That's fairly easy - and would be even easier if the ArisScript engine would comply with the EMCA2015 standard (or newer) giving us access to arrow functions - but sadly it does not support that, so you'll have to do something like

var nLocale = Context.getSelectedLanguage();
var objDefStringNameArray = objdefs.map(mapObjDefToString);

function mapObjDefToString(anObjDef) {
    return anObjDef.Name(nLocale);
}

The order of objects is retained throughout the mapping process, so when your dialog returns that the usere selected string element 2, 5 and 8 you can easily look up in your original array which objectdefs are at index position 2, 5 and 8.

 

Hope this helps.

 

0
by Noémie Farcuta Author
Posted on Tue, 09/29/2020 - 14:05

In reply to by Kay Fischbach

Thank you Kay Fischbach for your answer.

This works ! Also, I don't know how to catch the multiple selection, I tried this 

var listBoxObject = this.dialog.getDialogElement("LISTBOX_1");
 
      var currSelectionIndex = listBoxObject.getSelectedIndex();

but this return just the first element selected. How can I get them all ?

Thanks !

Noémie

 

0
by Kay Fischbach
Posted on Tue, 09/29/2020 - 14:59

In reply to by noemiefarcuta

Oh, you used .getSelectedIndex() of the SingleSelectElement interface.

ListBox actually also implements the MultiSelectElement interface, which has a method called .getSelection() that returns an array of integers - the index numbers of the selected elements.

var listBoxObject = this.dialog.getDialogElement("LISTBOX_1");
 
var currSelectionIndexes = listBoxObject.getSelection();

should give you what you're looking for.

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