Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Altered:
Function [other Function type actions]
Item [operators of similar scope]
Document configuration [other Document configuration operators]
9.2.0
9.2.0
createAttribute(name[, type])
From v9.2.0, the operator createAttribute(name[, type]) can create a new user attributes. If an attribute of the same name already exists, the operator has no effect and returns false. Otherwise, a new user attribute is created.
Optionally, a type argument may be supplied to determine the data type of the new attribute. Recognised values for type include: string
, number
, boolean
, date
, color
, interval
, file
, list
, set
, url
, and dictionary
. If no type valued is supplied, Tinderbox creates a String-type attribute.
A basic example using just the name argument, results in a new String-type attribute called 'MyList':
$MyBoolean = createAttribute("SomeList");
But, in the example above, the chosen name for the new attribute indicates the intended data-type should be of List data type. Therefore, use of the optional type argument would make more sense to signal user intent to Tinderbox more clearly:
$MyBoolean = createAttribute("SomeList", "list");
Again, the action results in a new String-type attribute called 'MyList'.