arc:set

Version 24.2.8965


arc:set


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

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

Parameters

  • item: Specify the item in which the attribute is set. If an item is not specified, the default item is used.
  • attr: The name of the attribute. You can also specify the item using dot notation (for example, item.prefix:attr).
    • 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 a hash (#). This means that the array can contain more than one value, where each value can be referred to using 1-based indexing. For example, attr="myitem.myattribute#2" refers to the second value in the myattribute attribute.
  • value: The value to assign 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 when setting long or multi-line values.
  • copyfrom: The attributes from the item specified in this parameter are copied to the item specified by the item parameter.

Control Attributes

None

Example

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.