Class Ruote::Exp::SetExpression
In: lib/ruote/exp/fe_set.rb
Parent: FlowExpression

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'
  end

: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.

:escape

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

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'
  end

can be rewritten as

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

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

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

Methods

apply   reply   set_f   set_v   set_vf  

Constants

PREFIX_REGEX = /^([^:]+):(.+)$/ unless defined?(PREFIX_REGEX)

Public Instance methods

Protected Instance methods

[Validate]