• <Helps for GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • 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
        • Accept Function
        • Advance Statement
        • Ask Statement
        • ChangeKeyboard Function
        • Connection Function
        • DeMode Function
        • Display Orientation
        • EditNote Function
        • EndLevel Statement
        • EndGroup Statement
        • Enter Statement
        • GetCaptureType Function
        • GetCaseLabel Function
        • GetDeviceID Function
        • GetImage Function
        • GetNote Function
        • GetOperatorId Function
        • GetOS Function
        • GetRecord Function
        • GetUserName Function
        • GPS Function
        • Interactive GPS Modes
        • HideOcc Function
        • Highlighted Function
        • InAdvance Function
        • IsPartial Function
        • IsVerified Function
        • Move Statement
        • NoInput Statement
        • OnChangeLanguage Global Function
        • OnChar Global Function
        • OnKey Global Function
        • OnStop Global Function
        • OnSystemMessage Global Function
        • Prompt Function
        • Protect Function
        • PutNote Function
        • RandomizeVS Function
        • Reenter Statement
        • SavePartial Function
        • SelCase Function
        • Set Attributes Statement
        • Set Behavior CanEnter Statement
        • SetCapturePos Function
        • SetCaptureType Function
        • SetCaseLabel Function
        • Set ErrMsg Statement
        • SetFont Function
        • SetOperatorId Function
        • Show Function
        • ShowArray Function
        • ShowOcc Function
        • Skip Statement
        • Userbar Function
        • VisualValue Function
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
      • Export Attributes
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Appendix
  • <Helps for CSEntry>
  • <Helps for CSBatch>
  • <Helps for CSTab>
  • <Helps for DataViewer>
  • <Helps for TextView>
  • <Helps for TblView>
  • <Helps for TRSWin>
  • <Helps for CSDeploy>
  • <Helps for CSPack>
  • <Helps for CSFreq>
  • <Helps for CSSort>
  • <Helps for CSExport>
  • <Helps for CSReFmt>
  • <Helps for CSDiff>
  • <Helps for CSConcat>
  • <Helps for TRSSetup>
  • <Helps for ParadataViewer>
  • <Helps for ParadataConcat>
  • <Helps for CSIndex>
  • <Helps for Excel2CSPro>
  • <Helps for CSWeb>

OnSystemMessage Global Function

Format
function numeric OnSystemMessage(ʃnumeric message_numberʅʃ, numeric message_typeʅʃ, string message_textʅ);
Description
OnSystemMessage is a special global function. It is a function that gets called when a system message is issued. This is similar to the OnKey or OnStop functions, which get called automatically by the running CSPro application, not because of a call to the function in your logic. A system message is a message such as "Invalid subscript," not a user message that comes from an errmsg statement.
The function must return a numeric value and you can provide from one to three parameters. If one numeric parameter is provided, then it will receive the message number. If two numeric parameters are provided, the second numeric parameter will get the message type (1 = error, 2 = warning). If a string parameter is provided, then it will receive the message text.
Return Value
Return 0 (false) to suppress the message. Returning anything other than 0 means that the message will be issued (displayed to the enumerator in a data entry application or written to the listing file in a batch application).
Example 1
function OnSystemMessage(numeric message_number, numeric message_type)

   
// suppress all warning messages
    recode message_type -> OnSystemMessage;
           
1            -> true;
           
2            -> false;
   
endrecode;

end;
Example 2
function OnSystemMessage(numeric message_number, string message_text)

   
// modify the displayed message for invalid subscript errors
    if message_number = 1008 then
       
errmsg("Subscript Error (%d). Most likely cause is no children in household. %s", message_number, message_text);

       
// suppress the system message
        exit false;

   
endif;

   
// issue the message in all other cases
    exit true;

end;
See also: User-Defined Functions, Function Statement