FIND Action

UDP ›› Actions ››
Parent Previous Next

FIND Action

The FIND action finds particular instances of a business object or business object group in the system. There are several variations of the action:

   

1.      Find all instances of the specified business object or group. For example,

   

FIND ALL Account  

   

2.      Run the specified query that finds particular instances of the business object or group. For example,

   

FIND 'Open accounts'  

   

The action above will run the query named ‘Open accounts’. Note that the apostrophe must only be used if the query name contains space symbols otherwise the identifier of the query name can be used without the apostrophe.

   

3.      Find all instances of the business object or group that match the specified condition. For example,

   

FIND Account WHERE Account.State = 'Open'  

   

The condition must be specified after the “WHERE” keyword. The format of the condition is exactly the same as the one used in the Rule Condition.

   

The following keywords can be optionally used after the FIND action (written in any of the above formats):

   

1.  ORDER BY  

   

If this keyword is used after the FIND action, the instances found by the action will be sorted by the specified attribute in the specified order. For example,

   

FIND ALL Account ORDER BY Account.Balance DESC

   

The above action finds all accounts sorted by their balances in the descending order. The ASC keyword indicates the ascending order and the DESC keyword indicates the descending order. If ASC and DESC keywords are omitted the ASC keyword is implied.

   

2.  TAKE BEST  

   

If this keyword is used after the FIND action, only the specified number of business object instances which match the specified criteria, will be found by the action. Typically this keyword is used together with the ORDER BY keyword. For example,

   

FIND ALL Account ORDER BY Account.Balance DESC TAKE BEST 5 

   

The above action will find 5 accounts with the highest balance.

   

3.  IN BATCHES OF  

   

If the action is likely to find many instances of the business object (hundreds or even thousands) their processing may take a while. In this case it is better to perform the processing of instances in smaller chunks (batches). After processing of each batch is finished the results will be immediately committed to the system and stored in the database. If the batch size is not specified the system will only commit the results once all the instances have been processed (see Batch Operations). For example:

   

FIND Account WHERE Account.State = 'OPEN' AND Account.Balance > 1000 ORDER BY Account.Balance IN BATCHES OF 5  

Perform some actions with found objects  

(The actions will be performed in batches of 5 objects)  

   

If IN BATCHES OF keyword is omitted the default batch size of 1000 is used.