Scripting with MScript

Top  Previous  Next

MoreMotion provides a scripting language called "MScript". MScript is a simple yet powerful language that aims to leverage the responsibilities of MoreMotion units by means of scripting their parameters.

MScript can be embedded in the parameters of MoreMotion units (Data Sources, Processes, etc.). For instance it can be used inside a database query as follows:

  <process name="AddOrder" basedon="mor.RelDB.RelDBUpdateProcess">
    <param name="query">
  selecT count(*) as v:CNT FROM product_categories WHERE NAME = '@vof(NAME)';
  @doif(v:CNT = 0) 
  INSERT INTO products_categories  
    (NAME) VALUES('@vof(NAME)');
  @doend()
  </param>
  </process> 

 

Unlike other scripting languages, MScript does not target to cover all types of works with one single language. The main goal of MScript is to flexibly and dynamically specify the parameters of the runtime functional unit that it resides in.

Loops

MScript does not have functions such as for and while. since looping in not the objective of MScript.

 

Operators

Symbols

Functions

Processing Order of the Functions

Remover Commands

 

Custom Functions

 

Data Types

An MScript expression can contain one or more of the following data types:

Data Types

Examples

Numeric Constant

1.12, 54.2, -12.34

Boolean Constant

true, false

String Constant

'ABC', 'This is a string''Alfredo''s Car'

Symbols

i:NAME, f:Age, v:_cmd, r:/XXX/YYY

 

Nested Functions

It is possible to use the MScript functions nested within each other.

Example:

  @vof(ucase(sstrb(i:NAME,':')))
  @set( v:date, 
    fmtdate(  
      incrdate(
        parsedate(i:DATE,'yyyy-MM-dd'),
        'DAY',1),
      'yyyy-MM-dd') )

 
Commenting Symbols: '@//'

The functions that take part after the  '@//' characters are ignored 

Examples:

  @set(a,'xyz') @// set 'xyz' to a

  @// @set(b,12) the @set function on this line will be ignored.