AIML Docs

Assign Element

Element for modifying data model values

Assign Element

Coming soon: This feature is not yet available. Please check back soon.

The <assign> element modifies the data model:

<assign 
location="state.count"
action="increment"
/>
PropTypeDefault
location
string
-
action?
string
-
expr?
Expression
-

Examples

Basic Assignment

<assign location="state.name" expr={({userInput}) => userInput.name} />

Increment Counter

<assign location="state.count" action="increment" />

Append to Array

<assign 
location="state.items" 
action="append" 
expr={({userInput}) => userInput.newItem} 
/>

Usage Notes

  • Use clear location paths that reflect the data structure
  • Consider using expressions for dynamic values
  • Choose appropriate action types for the operation
  • Validate data before assignment when necessary

On this page