Variable Pool

Top  Previous  Next

MoreMotion creates a globally accessible variable pool for each request and purges it after the request is responded. Since it is globally accessible , all types of MoreMotion Units (Services, Processes, etc.) can read from and write to it.

The duration of the variable pool is limited to the duration of the request. Prior to the termination of the request, the content of the variable pool is transferred to a built-in data source called "var".

   <root>
    <var>
      <_nextpage>Products</_nextpage>
      <_maxcc>4</_maxcc>
      <total_price>2400</total_price>
      <duplicate_key>true</duplicate_key>
    </var>
  </root> 

 

Accessing Variable Pool using MScript Functions

MScript functions can use pool variables. Here is an example:

  @doif( getnp() = 'Products')
    @set(v:total_price, v:total_price + (quantity * unit_price) )
  @doend()
  ..

 

Accessing Variable Pool using mmExec API

Variable Pool Object can be obtained using mmExec API.

  VariablePool vpool = request.getVPool();
  vpool.put("duplicate_key","true");