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
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
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");