arc:set

Version 23.4.8839


arc:set

Version 23.4.8839


The arc:set keyword sets a value in an attribute. If an attribute is set in an item that does not exist, the item is automatically created.

There are two ways to set a value using arc:set. You can set the value parameter or, for large values that are multiline and complex, you can set the value using the scope of the keyword itself.

Parameters

  • item: The item parameter is used to specify the item in which the attribute is set. Specifying an item is not required. If an item is not specified, the default item is used.
  • attr: The name of the attribute. You can also specify the item using the dot notation (e.g., item.prefix:attr). Note that a complete attribute name has both a prefix and an attribute name, but the prefix is not required.
    • Attributes can also be denoted as an array by using the # character. This means that the array can contain more than one value, where each value may be referred to using 1-based indexing.
    • For example, attr="myitem.myattribute#2" would refer to the second value in the myattribute attribute.
  • value: The value to be assigned to the attribute. If this parameter is not provided, the entire body of the arc:set keyword is used as the value. This is convenient for setting long or multiline values.
  • copyfrom: The attributes from the item specified in this parameter are copied to the item specified by the item parameter.

Control Attributes

None

Examples

Use the scope of the keyword to set a value to the message attribute of the item named “input”:

<arc:set item="input" attr="message">
  Dear [name],
  You have won a cruise trip to Hawaii.
  Please confirm your acceptance by [date].
  Thanks, [sales]
</arc:set>

See Also

  • arc:unset: Remove an attribute from an item.
  • arc:setm: Set multiple attributes with only one keyword.