Greetings Community,
Here is my dilemma.
I am importing raw string data into attributes. Some of these attributes have a pre-set list of allowable values. In order to use:
attribute.setValue(<value>)
<value> has to be an integer. The problem is, I am not sure how I can compare my raw string data to the data in the pre-set list represented by an integer.
The image shows the properties of this one of the attributes. Note the pre-set list of allowable values.
If I am importing a raw string, how do I obtain the pre-set collection from the attribute using Aris Script?
Rick Beddoe
Cargill Aris Technical Analyst
Minneapolis, MN, USA

Ciska de Jager on
Hi Rick,
I've created my own function to obtain possible attribute values (for drop-down attribute selection values)
function getAttributeValues(iattrnum)
{
var AttrArray = new Array();
var attValTypes = ArisData.ActiveFilter().AttrValueTypeNums(iattrnum);
for(var a=0;a<attValTypes.length;a++) {
AttrArray.push(ArisData.ActiveFilter().AttrValueType(iattrnum, attValTypes[a]));
}
return AttrArray.sort();
}
It returns an array, if you want to do a quick test to determine if the value that you are importing is part of the pre-defined list you can use the command join to parse the array into a string and search the string for the imported value.
In order to use the setValue() command for above you don't need the integer - if your imported value is part of the pre-defined list you can use setValue with the imported value. for instance setValue("Removed") with update your attribute successfully.
Ciska