CREATE Action

UDP ›› Actions ››
Parent Previous Next

CREATE Action

The CREATE Action creates an instance of the specified business object. For example,

   

CREATE Account

   

CREATE action can optionally initialize one or more attributes of the business object that it creates, for example:

   

CREATE Account WITH Account.State='Open', Account.Balance=0  

   

The attributes to be initialized must follow the WITH keyword and must be separated by the comma. An initialization expression may contain any constant or other calculation.

   

Sometimes it may be necessary to create several instances of a business object with a single CREATE action. For example,

   

1.  CREATE Transaction FOR EACH Account  

2.  CREATE Transaction FOR EACH DAY/WEEK/MONTH/QUARTER/YEAR BETWEEN Account.OpeningDate AND Account.ClosingDate  

3.  CREATE Transaction FOR EACH NUMBER BETWEEN 1 AND 3  

4.  CREATE Attachment FOR EACH FILE IN 'c:/mydirectory'  

   

The action in the first example will create as many instances of the Transaction object as there are instances of the Account object in the Context.

   

The action in the second example will create as many instances of the Transaction object as there are days in the specified date interval. The date interval includes both starting and ending dates.

   

The action in the third example will create 3 instances of the Transaction. The interval includes both starting and ending numbers.

   

The action in the fourth example will create as many instances of the Attachment object as there are files in the specified directory.

   

  NOTE:  You can use LOOP_ITERATION expression to get values of the current file name, current date or current iteration number, for example:

   

CREATE TRANSACTION FOR EACH FILE IN 'c:/mydirectory' WITH Transaction.FileName=LOOP_ITERATION  

   

See also the “Aware IM Rule Language Reference” for more details.