$DATACOUNT (get result lines)
$DATACOUNT acquires the number of data items that were found by the most recent search that was executed.
When a search is defined within the [ASSET_ITEM_LOOP] and [ASSET_ITEM_LOOP_END] tags, the status following the [ASSET_ITEM_LOOP_END] tag is always NODATA. To determine whether or not applicable data exists, you must use the $DATACOUNT embedded function to acquire and evaluate the number of data items resulting from the search.
Syntax
return-value=$DATACOUNT()
Values
-
return-value
Specifies the name of the variable into which the search results lines are set.
Status
The following table lists and describes the possible statuses:
Status |
Description |
---|---|
NORMAL |
Normal end |
NODATA |
— |
ERROR |
— |
Script execution interrupted |
An invalid argument was specified, or an error other than the above occurred. |
Example
The following example outputs the number of asset information data items (100) whose status is active (002):
[CLASS_FIND] AssetInfo [FIND_DATA] (AssetInfo.AssetStatus = '002')AND (AssetInfo.AssetKind = '001') [GET_VALUE] WORK = AssetInfo.AssetNo [SET_VALUE] STATUS = $GETSTATUS() TOTAL = $DATACOUNT() [IF] STATUS = NORMAL [THEN] [SET_VALUE] MSG = 'DataCount :' +TOTAL $ECHO(MSG) [ELSE] [SET_VALUE] MSG = 'CLASS_FIND (' +STATUS+ ')' $ECHO(MSG) [IF_END]
- Execution result:
-
DataCount : 100