Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Tools : COUNTOCCURRENCES

COUNTOCCURRENCES
Returns the number of occurrences that meet a selection criteria. (F)
Invocation
count = COUNTOCCURRENCES(table, selection)
 
The selection criteria. Its syntax can be C (fixed-length character string), V (variable-length character string), or UN (Unicode).
Usage Notes
COUNTOCCURRENCES can be used for TDS, parameter (PRM), temporary (TEM), calculation (CLC), session (SES) tables, and Execution Environment (EES) tables.
You can base the selection criteria on any field of the table. For optimum performance, base the selection on a secondary index field.
Example
The following rule returns the number of employees who work for a regional company. The EMPLOYEE_REGION table is parameterized by region and MGR# is a secondary index field.

 
COUNT_STAFF(AREA, MANAGER);
_ LOCAL SELECTION;
_ ---------------------------------------------------------------------
_ ------------------------------------------------------------+--------
_ SELECTION = 'REGION = ''' || AREA || ''' & MGR# = ''' || | 1
_ MANAGER || ''''; |
_ RETURN(COUNTOCCURRENCES('EMPLOYEE_REGION', SELECTION)); | 2
_ ---------------------------------------------------------------------

 
If you executed this rule from the workbench and passed in the values of MIDWEST for the argument AREA and 56112 for the MGR#, the following result is returned at the bottom of your screen:
8:41:03 Result of rule COUNT_STAFF is 3

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved