Calculated Attribute expressions can be written using the following available functions. Examples follow the Available Functions table.
Note: Text used for 'attribute-id' and 'unit-id' is case-sensitive.
Available Functions
|
Function |
Parameters |
Description |
|---|---|---|
|
PRODVAL or VALUE |
('attribute-id') |
Return the value of the supplied attribute (attribute-id) for the current object. This also works for non-products, for example, by using the iterate function to get another current object. |
|
PRODVAL or VALUE |
('attribute-id', 'unit-id') |
Return the value of the supplied attribute (attribute-id) converted into the supplied unit (unit-id) for the current object. This also works for non-products, for example, by using the iterate function to get another current object. In order to convert units, relevant units must have a Base Conversion defined in the Units area of System Setup. |
|
PRODVALSIMPLE or SIMPLEVALUE |
('attribute-id') |
Return the value of the supplied attribute (attribute-id) for the current object, concatenated with the name of the unit (if any). For embedded numbers, this function returns a string like: suffix value unit-name prefix. |
|
PRODVALSIMPLE or SIMPLEVALUE |
('attribute-id', 'unit-id') |
Return the value of the supplied attribute (attribute-id), converted into the supplied unit (unit-id) for the current object, concatenated with the name of the resulting unit. For embedded numbers, this function returns a string like: suffix value unit-name prefix. In order to convert units, relevant units must have a Base Conversion defined in the Units area of System Setup. |
|
PRODUNIT or UNITOFVALUE |
('attribute-id') |
Return the name of the unit of the value of the supplied attribute (attribute-id) for the current object. The expression cannot evaluate the Unit from other Calculated Attributes. |
|
PRODUNITID or UNITIDOFVALUE |
('attribute-id') |
Return the ID of the unit of the value of the supplied attribute (attribute-id) for the current object. The expression cannot evaluate the Unit from other Calculated Attributes. |
|
ATTRNAME |
('attribute-id') |
Return the name of the attribute (attribute-id). |
|
GETEMBEDDEDPREFIX |
(PRODVAL('attribute-id')) |
Return the prefix part of an embedded number value. If (attribute-id) is not an embedded number, an empty text string is returned (rather than 'NA' which is returned by some functions). For more information about embedded numbers, see the Validation Rules of the System Setup / STEP Super User Guide documentation here. |
|
GETEMBEDDEDSUFFIX |
(PRODVAL ('attribute-id')) |
Return the suffix part of an embedded number value. If (attribute-id) is not an embedded number, an empty text is returned. For more information about embedded numbers, see the Validation Rules of the System Setup / STEP Super User Guide documentation here. |
|
GETEMBEDDEDVALUE |
(PRODVAL ('attribute-id')) |
Return the value part of an embedded number value. If (attribute-id) is not an embedded number, an empty text is returned. For more information about embedded numbers, see the Validation Rules of the System Setup / STEP Super User Guide documentation here. |
|
UNITCONV |
(value, unit-id, to-unit-id) |
Return number of ‘value’ in ‘unit-id’ converted into ‘to-unit-id’. |
|
VALUELOVID |
(attribute-id) |
Return the LOV ID of the LOV value of the supplied attribute (attribute-id) for the current object, if Value IDs are used on the LOV. If 'Use Ids on values' is set to 'No', N/A is returned. |
Examples
The examples below assume a setup including these attributes and products:
|
ATTRIBUTE Type |
ID |
Name |
AttrDesc |
|---|---|---|---|
|
Text-validated product attribute |
TEXT1id |
TEXT1 |
TEXT1 description |
|
Number-validated product attribute with length units |
NUMBER1id |
NUMBER1 |
NUMBER1 description |
|
Embedded number-validated product attribute with length units |
EMBEDDEDNUMBER1id |
EMBEDDEDNUMBER1 |
EMBEDDEDNUMBER1 description |
|
Text-validated attribute property |
AttrDescid |
AttrDesc1 |
AttrDesc description |
|
LOV-validated product attribute |
LOVAttr1id |
LOVAttr1 |
LOV description |
|
LOV with 'Use IDs on Values' = Yes; and Values =Yes and No |
LOV1id |
LOV1 |
|
|
PRODUCTS ID |
Name |
Parent |
TEXT1id |
NUMBER1id |
|---|---|---|---|---|
|
P-family-id |
P-family |
Product hierarchy root |
family value |
2 m |
|
P1id |
P1 |
P-family-id |
p1 value |
4 m |
|
P2id |
P2 |
P-family-id |
p2 value |
5 m |
|
P3id |
P3 |
P-family-id |
p3 value |
6 m |
Copy and paste any of the following examples into the Function Editor and then evaluate against the specified object to get the defined result.
prodval('TEXT1id') // = "family value" when evaluated on P-family-idprodval('NUMBER1id') // = "2" evaluated on P-family-idprodunit('NUMBER1id') // = "m" evaluated on P-family-idprodval('NUMBER1id', 'unece.unit.MMT') // = "2000" evaluated on P-family-idprodvalsimple('NUMBER1id') // = "2 m" evaluated on P-family-idprodvalsimple('NUMBER1id', 'unece.unit.MMT') // = "2000 mm" evaluated on P-family-idattrname('NUMBER1id') // = "NUMBER1" evaluated on P-family-idgetembeddedprefix(prodval('EMBEDDEDNUMBER1id')) // = "prefix" evaluated on P3idgetembeddedvalue(prodval('EMBEDDEDNUMBER1id')) // = "3" evaluated on P3idgetembeddedsuffix(prodval('EMBEDDEDNUMBER1id')) // = "suffix" evaluated on P3idprodvalsimple('EMBEDDEDNUMBER1id') // = "prefix 3 m suffix" evaluated on P3idprodvalsimple('EMBEDDEDNUMBER1id', 'unece.unit.MMT') // = "prefix 3000 mm suffix" evaluated on P3idprodunit('EMBEDDEDNUMBER1id') // = "m" evaluated on P3idunitconv('2','unece.unit.MTR','unece.unit.MMT') // = "2000" evaluated on P3idvaluelovid('LOV1Attrid') // = "LOV1id" evaluated on P3id
2017, Stibo Systems