[CLASS_FIND] (find object class)
[CLASS_FIND] searches an object class.
If the class being searched matches the specified conditions, its property values are substituted into the declared variables. You can specify the [CLASS_FIND] tag the number of times required to find the base object class.
Syntax
[CLASS_FIND] name-of-object-class-to-search ([FIND_DATA]) condition-expression [GET_VALUE] assignment-statement ([ORDER_ASC] or [ORDER_DESC]) sort-key
Values
-
name-of-object-class-to-search
Codes the name of the object class to be searched.
-
condition-expression
Codes the condition expression. To specify multiple search conditions, join them with an operator. For details about the operators that can be used in condition expressions, see 2.2.4 Operators.
You can omit the [FIND_DATA] tag if you do not use a condition expression.
-
assignment-statement
Codes an assignment statement. To acquire a display name, add the at mark (@) to the end of class.property.
-
sort-key
To sort the results, specify a sort key, in the format class.property. The [ORDER_ASC] tag sorts results in ascending order, and the [ORDER_DESC] tag sorts results in descending order. If the tag is omitted, the results are sorted in the order of properties specified by the [GET_VALUE] tag.
Status
The following table lists and describes the possible statuses:
Status |
Description |
---|---|
NORMAL |
Normal end. |
NODATA |
No data satisfies the search conditions. |
ERROR |
— |
MULTI |
— |
- Legend:
-
—: Not applicable
Example
The following example outputs the asset number of asset ID 10000:
[CLASS_FIND] AssetInfo [FIND_DATA] (AssetInfo.AssetID = '10000') [GET_VALUE] ASSETNO = AssetInfo.AssetNo ASSETSTATUS = AssetInfo.AssetStatus@ [SET_VALUE] STATUS = $GETSTATUS() [IF] STATUS = NORMAL [THEN] [SET_VALUE] MSG = 'ASSETNO = '+ASSETNO+'('+ASSETSTATUS+')' $ECHO(MSG) [ELSE] [SET_VALUE] MSG = 'CLASS_FIND ('+STATUS+')' $ECHO(MSG) [IF_END] |
- Execution result:
-
ASSETNO = R11111(active)