Tinderbox v9 Icon

attribute(attributeNameStr)[keyStr]


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

 Function  [other Function type actions]

 Document  [operators of similar scope]

 Document configuration  [other Document configuration operators]

 Baseline

 9.5.0, 9.6.0, 9.7.0


attribute(attributeNameStr)[keyStr]

The attribute() operator, for the specified attribute attributeNameStr, returns a Dictionary of key values that describe that attribute. Current keys include (names are all-lowercase and case-sensitive):

Key values

If any key is not set, e.g. there are no 'suggested' values, then an empty string is returned for that key.

All keys return as string, called via keyStr, but the most appropriate attribute type is shown as the recipient of the data:

$MyList = attribute("Width")["default"] 

$MyList = attribute("Width")["suggested"] 

$MyString = attribute("Width")["category"] 

$MyString = attribute("Width")["type"] 

$MyString = attribute("Width")["description"] 

Note that when using literal (i.e. actual) attribute name or keys it is recommended the word(s) are quote enclosed as above. If using variables, as in the earlier code examples, quotes are not used as this aids the Tinderbox parser detecting literal vs. variable usage.

Editing key values

Some keys can be modified via action code, all others are read-only. Actions may modify the default or suggested values of an attribute, and from v9.6.0 also description and lines:

attribute("attributeName")["suggested"]="value 1; value 2"; 

sets two values for the attribute's suggested values list. Likewise a default value can be set:

attribute("attributeName")["default"]="value 1"; 

Or a description:

attribute("Price")["description"]="The price of the item."; 

Thus, for instance, action code might find the discrete values for an attributes (use values() or collect(), etc.) and use that list to set/update the attributes suggested values (i.e. the suggested key value).

Setting property values

From v9.5.0, both the attribute name and/or the facet to be set may be enclosed in quotation marks (previously, use of quotes caused a failure):

attribute(AttributeName)[facet]="testing"; 

or

attribute("AttributeName")["facet"]="testing";