How do I compare an attribute value where you have a combo drop down (attribute list) in a report script? I've been trying all kinds of ways of getting the AT_STATE_1 attribute of models to see whether they are equal to Constants.AVT_RELEASED, but all I'm getting from the Model.Attribute() function is the string name of the value ("Released"). Apparently, the Model.Attribute() function returns an object of JS class AAttrLongDef, but whether I try value(), getValue(), GetValue(false), MeasureValue(), all I have to show for my pains is the string "Released". Names can be changed in the ARIS configuration, and be localized besides: I'd prefer doing a future-proof comparison. Any hints?
My example code: arisModelDef is a Model, g_nLoc is the locale. In my frustration, I pulled out the JS members in the attrs variable, and found 37 members of the result from Model.Attribute(), but none that seem to yield an integer value comparable with e.g. Constants.AVT_RELEASED.
var stateAttribute = arisModelDef.Attribute(Constants.AT_STATE_1, g_nLoc);
var stateObjValue = arisModelDef.Attribute(Constants.AT_STATE_1, g_nLoc).GetValue(false);
var stateValue = arisModelDef.Attribute(Constants.AT_STATE_1, g_nLoc).getValue();
var stateValue2 = stateAttribute.value();
var attrClass = stateAttribute.getClass(); // AAttrLongDef
var measure = stateAttribute.MeasureValue();
var attrs = new Array();
for ( m in stateAttribute )
attrs.push(m);
ARIS version: 10.0.13.10.1491549
Hello Pontus,
try arisModelDef.Attribute(Constants.AT_STATE_1, g_nLoc).MeasureUnitTypeNum(). It returns integer comparable with Contstants.AVT_RELEASED.
---
BR, Nikita
Ah, thanks: that did it! I would never have guessed that the enumeration values/value list/scalars/enums could also be called TypeNums – I assumed it was related to technical typing (ints, floats, strings) or to physical units of measure.