The SetAttributeValue EKL method defines the value of the given
attribute. You can only set one free attribute. Otherwise all protected attribute
modifications raise an exception.
Signature
SetAttributeValue(attributeName:String, attributeValue:ObjectType) : VoidType
Argument
| String |
Required/Optional |
Comment |
Execution Profile |
attributeName (String) |
|
Name of the attribute to specify. |
Local Read |
attributeValue (ObjectType) |
|
Value of the attribute to specify. |
Local Read |
SetAttributeValue
Let stringListValue (List)
Let integerListValue (List)
//simple attributes
ThisObject.SetAttributeValue("attrLength", "23.15 MM")
ThisObject.SetAttributeValue("attrReal", "03.00")
ThisObject.SetAttributeValue("PLMSGReference.SGRefStrg","this is a test")
ThisObject.SetAttributeValue("PLMSGReference.SGRefIntg", 12)
ThisObject.SetAttributeValue("PLMSGReference.SGRefDble", 1.2)
//multivalued attributes
stringListValue->Append("this")
stringListValue->Append("is")
stringListValue->Append("my")
stringListValue->Append("test")
ThisObject.SetAttributeValue("PLMSGReference.SGRefStrgLst", stringListValue)
integerListValue ->Append(1)
integerListValue ->Append(2)
integerListValue ->Append(3)
ThisObject.SetAttributeValue("PLMSGReference.SGRefIntgLst", integerListValue)
You can also set the values with their unit using the following format:
Let length_value(LENGTH)
Let inputs(Number_inputs) /* new extension type */
Let inputvalue(String)
Let inputunit(String)
length_value = (ThisObject.GetAttributeValue("attrLength") : LENGTH)
set inputs = length_value
if (inputs <> NULL) {
inputvalue = inputs.inputvalue()
inputunit = inputs.inputunit()
Trace(1, "inputvalue: # inputunit:#", inputvalue, inputunit)
/* displays: inputvalue: 23.15 inputunit: MM */
}
length_value = 2m
set inputs = length_value
if (inputs == NULL) {
Trace(1, "Volatile values don’t support inputvalue/inputunit")
}
Let dimensionList (List)
…
dimensionList->Append("21.0975 KM")
dimensionList->Append("42.1950 KM")
ThisObject.SetAttributeValue("PLMCKESample2Reference.M_LENGTH",dimensionList)