Setting a workitem field or a process variable.

              sequence do
                set :field => 'subject', :value => 'food and beverage'
                set :field => 'date', :val => 'tomorrow'
                participant :ref => 'attendees'

:field can be abbreviated to :f or :fld. :variable can be abbreviated to
:v or :var. Likewise, :val and :value are interchangeable.

field_value, variable_value

Usually, grabbing a value from a field or a value will look like

              set :f => 'my_field', :value => '${v:my_variable}'

But doing those ${} substitutions always result in a string result. What
if the variable or the field holds a non-string value ?

              set :f => 'my_field', :var_value => 'my_variable'

Is the way to go then. ‘set’ understands v_value, var_value, variable_value
and f_value, fld_value and field_value.


If the value to insert contains ${} stuff but this has to be preserved,
setting the attribute :escape to true will do the trick.

              set :f => 'my_field', :value => 'oh and ${whatever}', :escape => true

:override / :over

(attribute introduced in ruote 2.3.0)

When setting a variable with no slash prefix, the target will always be the
most local scope. When one wants to purposely override/overwrite an already
set variable, the attribute :override can be set to true.

In this example, although the second ‘set’ happens in its own scope, the
variable v0, will be set to ‘b’ in the initial (top) scope:

              pdef = Ruote.define do
                set 'v:v0' => 'a'
                sequence :scope => true do
                  set 'v:v0' => 'b', :over => true

:over(ride) tells the ‘set’ expression to locate where the var is set
and change the value there.

:over is ignored for process (/) and engine (//) variables. It has no
meaning for workitem fields.

When :over is set to ‘sub’ (or :sub), the :over => true behaviour is
followed, but it doesn’t cross into the parent subprocess.

ruote 2.0’s shorter form

Ruote 2.0 introduces a shorter form for the ‘set’ expression :

              sequence do
                set :field => 'f', :value => 'val0'
                set :variable => 'v', :value => 'val1'
                set :field => 'f_${v:v}', :value => 'val2'

can be rewritten as

              sequence do
                set 'f:f' => 'val0'
                set 'v:v' => 'val1'
                set 'f:f_${v:v}' => 'val2'

since ‘f:’ is the default for the ‘dollar notation’, the shortest form

              sequence do
                set 'f' => 'val0'
                set 'v:v' => 'val1'
                set 'f_${v:v}' => 'val2'

shorter form and non-string values

Dollar substitutions like ‘${a}’ will always squash the field or the
variable into a string. It’s useful, especially when one is doing
‘user-${name}’, but when the field (or variable) is an array or an hash

              set 'f' => '${array}'

will put the string representation of array into the field ‘f’, not
a copy of the array itself.

This will copy the array into the field ‘f’:

              set 'f' => '$f:array'

Note the mandatory ‘f:’. There is a thing to be aware of: if the field
array is missing, it will resolve into “$f:array” (no substitution at all).

There is always the old-style fallback:

              set :field => 'f', :field_value => 'array'

set and rset

Some gems (Sinatra) for example may provide a set method that hides calls
to set when building process definitions (see

A workaround is to write ‘rset’ instead of ‘set’.

              rset 'customer' => 'Jeff'


‘unset’ is the counterpart to ‘set’, it removes a field (or a variable)

              unset :field => 'customer_name'
              unset :f => 'customer_name'
              unset :variable => 'vx'
              unset :var => 'vx'
              unset :v => 'vx'

or simply

              unset 'f:customer_name'
              unset 'customer_name' # yes, it's field by default
              unset 'v:vx'

using set with a block

(not a very common usage, introduced by ruote 2.3.0)

‘set’ can be used with a block. It then behaves like a ‘sequence’ and
picks its value in the workitem field named ‘result’.

              set 'customer_name' do
                participant 'alice'
                participant 'bob'

Here, alice or bob may set the field ‘result’ to some value,
that will get picked as the value of the field ‘customer_name’.

Note that inside the set, a blank variable scope will be used (like in
a ’let).


‘set’ and ‘unset’ place the [un]set value in the field named result.

              sequence do
                set 'f0' => 2
                participant 'x${__result__}''

will route a workitem to the participant named ‘x2’.