Profile picture for user Christian Zanardi

Hello Community !!

I'm looking for code that could extract the list of values (and perhaps associated symbol) defined to fill a attribute, as defined in the method.

And to go further, a way to set this available values

The use case is : 

1. I define a attribute call "Country" 

2. I set list of values for "Country" ==> "England", "France", "Italy",.....

3. So now, when I create an object, I can fill "Country" with predefined values.

What I would like, is provied a report that extract this list in order to check if nothing is missing in the list of available countries.
And to go further, is to populate this list of country from external sources to automate this.
And further more, associate the values to a symbol (the flag of the country)

Thank you in advance for your interest and anwers

Christian

by Christian Zanardi Author
Posted on Fri, 01/13/2023 - 15:56

Hello All,
I finaly found all methods to read informations about attribute, list of values, and symbols associated to values :

// Recuperation de la methode
var oMethodFilter = ArisData.ActiveFilter();


// Recuperation des codes de langues
var g_Anglais   = Constants.LCID_ENGLISHUS;
var g_Francais  = Constants.LCID_FRENCH;

main();

function main() {
    

    var lAttrTypeNum = oMethodFilter.GetTypes(Constants.CID_ATTRDEF);
    var nbAttrTypeNum = lAttrTypeNum.length;
    

    for(i=0;i<nbAttrTypeNum;i++) {
        
        var attrTypeNum = lAttrTypeNum[i];
        
       
        // I only do the job for a specific attribute 
        if (attrTypeNum == 985815) {

            // recuperation du nom de l'attribut selon la langue
            oMethodFilter.setMethodLocale( g_Anglais );
            var nameEN = oMethodFilter.getItemTypeName( Constants.CID_ATTRDEF, attrTypeNum );
            
            oMethodFilter.setMethodLocale( g_Francais );
            var nameFR = oMethodFilter.getItemTypeName( Constants.CID_ATTRDEF, attrTypeNum );

            
            // Recuperation de la liste des valeurs
            var lAttrValueTypeNum = oMethodFilter.AttrValueTypeNums( attrTypeNum );
            var nbAttrValueTypeNum = lAttrValueTypeNum.length;

            
            for(j=0;j<nbAttrValueTypeNum;j++) {
                
                var attrValueTypeNum = lAttrValueTypeNum[j];
                
                // recuperation de la valeur de la valeur
                oMethodFilter.setMethodLocale( g_Anglais );
                var valueEN = oMethodFilter.AttrValueType( attrTypeNum, attrValueTypeNum );
                
                oMethodFilter.setMethodLocale( g_Francais );
                var valueFR = oMethodFilter.AttrValueType( attrTypeNum, attrValueTypeNum );
                
                
                // Recuperation du type number du symbole associée à la valeur
                var oAttrValueSymbol = oMethodFilter.AttrValueSymbol( attrTypeNum, attrValueTypeNum );
                
                // Recuperation du nom du symbol
                oMethodFilter.setMethodLocale( g_Anglais );
                var symbolNameEN = oMethodFilter.SymbolName( oAttrValueSymbol );
                
                oMethodFilter.setMethodLocale( g_Francais );
                var symbolNameFR = oMethodFilter.SymbolName( oAttrValueSymbol );
             
            }
        }
    }    
}

And the first part of my goal is reached :)

Now, my question is : is there some methods to SET new values ?
It seems that the "Method" or "Filter" cannot be changer via API ? Can you confirm that ?

Thank you in advance...

Christian

1
by Martin Schröder
Badge for 'Contributor' achievement
Posted on Fri, 01/13/2023 - 17:58

Salut Christian,

setting attribute enumeration values was already discussed here.

AFAIK the list of country names can only be populated manually, not uploaded, as it was not intended to use dynamic data in the method configuration (reasons are explained here)

Regards, Martin

0
by Michel Bénard
Posted on Mon, 01/16/2023 - 09:29

Bonjour Christian

If your "country" attribute is a custom one I believe you may have problems with

 var attrTypeNum = lAttrTypeNum[i];
        
       
        // I only do the job for a specific attribute 
        if (attrTypeNum == 985815) {

as it is my understanding that attribute type values may change when for example the Aris server restarts, and your code may break should the country type num be changed.

on the contrary attribute GUIDs are immutable 

var filter = ArisData.ActiveFilter();

var attributeType = filter.UserDefinedAttributeTypeNum("your attribute guid as seen on Aris architect/method");

1

Featured achievement

Explorer
Take a tour! Learn more about the different ARIS Community areas and ARIS editions.
Recent Unlocks
  • SA
  • KK
  • 先安
  • RV
  • AD
  • PacMan

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