Select

This command is used to select resources for Class. The filter condition is applicable if a class field for an attribute or the default property matches the comparator against value. The comparison is done based on the type of field. For example, if the field is data type (such as ‘effective from’ system attribute), the value must be a valid date.

Note: Multiple filters can be applied in which all conditions must be met.

The $selection_size variable is set to the number of selected resources, on successful completion of selection process. The selection is retained only for the duration of workflow, including nested or outer workflow.

An explicit date format can be specified by using the date value with a format specifier as prefix which indicates the sequence of (d)ay, (m)onth and (y)ear. For example:

  • dmy: 31-12-2019 is ‘31st Dec 2019’
  • ymd: 19-01-02 is ‘2nd Jan 2019’
  • mdy: 3-1-19 is ‘1st Mar 2019’
Note: 
  • '‘nil’ or ‘null’ is used to indicate no value.
  • The value is considered as nil if the field has no value. A string field is considered nil if the value is an empty string (zero length).
Syntax
Select: <class>.<field> <comparator> <value>[, <field2> <comparator2> <value2>][... , <fieldN> <comparatorN> <valueN>];
Log message
An appropriate message is logged on successful completion to indicate the number of records selected for the specified class. For example:
APACS212=Selected {0} resources for class "{1}".
  • (0} = number of resources selected;
  • {1) = class for which resources were selected.
This table lists the exception conditions and the related error message (if applicable) during the execution of the command:
Condition Message
When the class is not a valid class name in the model. An error is reported, and the selection becomes empty.
When the field (field2 … fieldN) is not valid for class.

This includes referring to system attributes which are not valid for class. For example, “effective from” where class has no effectivity type, or “distribution” where class is not an allocation class.

An error is reported, and the selection becomes empty.
If the value cannot be converted to the expected type of field. An error is reported, and the selection becomes empty.
If the field is a date field, the value must be a date value.

This includes system attributes effective from, effective to, effective at.

APACS250=Invalid value "{0}" for filter on date attribute "{1}".
If the field is a numeric field, the value must be a numeric value. This includes default properties, and system attribute distribution.
APACS249=Invalid value "{0}" for filter on numeric attribute "{1}".
If the field is a property. This error is reported, and the selection becomes empty:
APACS251=Property "{0}" provided for filter.  Cannot filter on a property.
This table lists the examples of the Select command:
Requirement Syntax
Select all resources of class “Class”, which have a name containing the value “PL”. Select: Class.name ~ PL;
Select all resources of class “Class”, which have user attribute “type” equal to the value “FP”, AND which have default property "std cost (*)" equal to 0. Select: Class.type = FP, std cost (*) = 0;
Select all resources of class “Class”, which do not have an “effective at” date set. The class has an effectivity type of “moment”. Select: Class.effective at = ;
Select all resources of class “Class”, which have an “effective from” date after 29-January-2019. The class has an effectivity type of “range” Select: Class.effective from > 29-01-2019;
Select all resources of class “Class”, which have no “effective from” value. The class has an effectivity type of “range”. Select: Class.effective from = nil;