• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
        • Average Function
        • Count Function
        • CurOcc Function
        • Delete Function
        • GetOccLabel Function
        • Insert Function
        • Max Function
        • MaxOcc Function
        • Min Function
        • NOccurs Function
        • Seek Function
        • SeekMax Function
        • SeekMin Function
        • SetOccLabel Function
        • SOccurs Function
        • Sort Function
        • Sum Function
        • Swap Function
        • TotOcc Function
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Count Function

Format
i = count(multiple_itemʃ where = conditionʅ);
Description
The count function returns the number of occurrences for a repeating form or roster. During data entry, the occurrence value is updated after execution of the postproc for the first field within the repeating form or roster. Note the situations impacting this value:
  • If the count function is executed prior to the form or roster, it returns 0.
  • If it is executed from a field within the form or roster, it returns the current occurrence number.
  • If it is executed after the form or roster, it returns the total number of occurrences in the form or roster.
  • During batch editing, count always returns the total number of occurrences in the multiply-repeating item/record.
    If a where condition is included, the function returns the number of occurrences for which the condition is true. If the where condition is not included, the count function and the noccurs function return the same result.
    Return Value
    The function returns an integer count value.
    Examples
    TOTAL_PERSONS = count(PERSONS);

    NUM_CHILDREN = 
    count(PERSONS where RELATIONSHIP = 3);
    See also: NOccurs Function, SOccurs Function, TotOcc Function, CurOcc Function, Seek Function, Has Operator