FocCount

The FocCount stack variable contains the number of rows in the stack. In an empty stack, FocCount is 0. This variable is automatically maintained and the user does not need to do anything when new rows are added or deleted from the stack. For example, the following stack variable contains the number of rows in the EmpInfo stack:

EmpInfo.FocCount

The FocCount variable is useful as a test to see whether a data source retrieval command is successful. For example, after putting data into a stack, FocCount can be checked to see if its value is greater than zero. FocCount can also be used to perform an action on every row in a stack. A repeat loop can be set up to loop the number of times specified by the FocCount variable.

The following example computes a new salary for each row retrieved from the data source:

FOR ALL NEXT Emp_ID Curr_Sal INTO Pay;
COMPUTE Pay.NewSal/D12.2=;
REPEAT Pay.FocCount Cnt/I4=1;
  COMPUTE Pay(Cnt).NewSal/D12.2 = Pay(Cnt).Curr_Sal * 1.05;
ENDREPEAT Cnt=Cnt+1;

WebFOCUS