api:set
Version 25.3.9411
Version 25.3.9411
api:set
Use the api:set keyword to set a value in 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 api:set:
- Set the value parameter.
- Set the value using the scope of the keyword itself. This is useful for large, multi-line, complex values.
Parameters
- item: Used to specify the item in which the attribute is set. If no item is specified, the default item is used.
-
attr: The attribute name. You can also specify the item using dot notation (for example,
item.prefix:attr).Note: A complete attribute name has a prefix and an attribute name, but the prefix is not required.
- value: The value to assign to the attribute. If this parameter is not provided, the entire body of the
api:setkeyword is used as the value. This is convenient for setting long or multi-line values. - copyfrom: The attributes from the item specified in this parameter are copied to the item specified by the
itemparameter.
Control Attributes
None
Example
Use the scope of the keyword to set a value to the message attribute of the item named input:
<api:set item="input" attr="message">
Dear [name],
You have won a cruise trip to Hawaii.
Please confirm your acceptance by [date].
Thanks, [sales]
</api:set>