Tinderbox v10 Icon

attribute(attributeNameStr)[keyStr]


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Data Type Returned: 

Operator First Added: 

Operator in Current Baseline: 

Operator Last Altered: 

 Function  [other Function type actions]

 Document  [operators of similar scope]

 Document configuration  [other Document configuration operators]

 Dictionary [about Dictionary data type]

 v9.0.0

 Baseline

 10.1.1, 9.6.0


attribute(attributeNameStr)[keyStr]

The attribute() operator, for the specified attribute attributeNameStr, returns a Dictionary of key values that describe that attribute. From v10.1.1, attributeNameStr may be a variable or attribute value instead of a literal string. Keys names are all-lowercase and case-sensitive. The current keys are listed below. Keys are editable value attribute

Some read-only properties may be modified via the User Attributes Inspector, but not via action code.

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 a value called via keyStr. The most appropriate attribute type is shown as the recipient of the data:

$MyString = attribute("Width")["category"] 
$MyList = attribute("Width")["default"] 
$MyString = attribute("Width")["description"] 
$MyNumber = attribute("Width")["lines"] 
$MyBoolean = attribute("Width")["readonly"] 
$MyBoolean = attribute("Width")["sequential"] (as 'YES' coerces to true)
$MyList = attribute("Width")["suggested"] 
$MyString = attribute("Width")["type"] 

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.

Attribute categories

All attributes belong to an organisation group, and this is stored in the category property. Note that whilst system attributes comprise a series of groups, all user attributes are in group 'user'.

Editing key values

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

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

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"; 

See also—notes linking to here: