Skip to main content
Version: 5.x

CHANGECLASS operator

The CHANGECLASS operator creates an action that changes objects classes.

Syntax

CHANGECLASS expr TO className [WHERE whereExpr]

Description

The CHANGECLASS operator creates an action that changes the class of objects for which a certain condition is met. This operator can add its local parameter, which will correspond to the objects being iterated. In this case, the WHERE block is required. This local parameter will not be a parameter of the action being created.

Parameters

  • expr

    An expression or typed parameter. You can either use an already declared parameter as a typed parameter, or declare a new local parameter. When using an expression, new local parameters cannot be added.

  • className

    The name of the class to which you want to change the object classes. A composite ID, since the class must be a custom class.

  • whereExpr

    An expression whose value is a condition for the created action. If not specified, it is considered equal to TRUE.

Examples

CLASS Document;
date = DATA DATE (Document);

CLASS ClosedDocument : Document;
// sets status to closed for all documents with a date older than 2 weeks
changeStatus() {
CHANGECLASS Document d TO ClosedDocument WHERE sum(date(d), 14) <= currentDate();
}