• <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
      • General Functions
        • Compress Function
        • Decompress Function
        • diagnostics Function
        • Encode Function
        • ErrMsg Function
        • ExecSystem Function (Desktop)
        • ExecSystem Function (Mobile)
        • ExecPFF Function
        • GetProperty Function
        • GetLabel Function
        • GetLanguage Function
        • GetSymbol Function
        • GetValueLabel Function
        • hash Function
        • htmldialog Function
        • InValueSet Function
        • Invoke Function
        • IsChecked Function
        • loadsetting Function
        • LogText Function
        • MaxValue Function
        • MinValue Function
        • paradata Function
        • PathConcat Function
        • PathName Function
        • savesetting Function
        • SetLanguage Function
        • SetProperty Function
        • SetValueSet Function
        • SetValueSets Function
        • Special Function
        • sqlquery Function
        • Stop Function
        • SysParm Function
        • tr Function
        • Trace Function
        • UUID Function
        • View Function
        • Warning Function
      • 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>

Warning Function

Format 1
i = warning(string_expʃ, argument1, ..., argument20ʅ);
Format 2
i = warning(msg_numʃ, argument1, ..., argument20ʅ);
Format 3
i = warning(string_expʃ, argument1, ..., argument20ʅ)

   
ʃselect(caption1, fieldname1ʃ, ..., caption5, fieldname5ʅ) ʃdefault(default_option)ʅ ʅ
   
ʃcase ‖ summaryʅ
   
ʃdenom = numeric_denomʅ;
Description
The warning function is similar to the errmsg function, with the function only having special behavior within a data entry application. If used in a batch or tabulation application, it behaves identically to errmsg.
The warning function differs from errmsg in that it can be used for "soft check" error messages. These messages will not be displayed to the operator when advancing in the case (such as when resuming from a partial save). This can also be useful for information you want to display just once to the operator, such as during initial entry of a field, rather than when the operator is moving from one section to another section, and the field in question lays somewhere in between.
Each argument is sequentially inserted into the warning message. Arguments can be numeric or alphanumeric expressions, but the type of the argument must match the type of the receiving field in the message text (see errmsg for a complete description of the function's arguments). The maximum number of arguments is 20. If messages are defined via the message number msg_num, then those messages will be stored in a message file. msg_num can be a number or numeric expression.
If using the select option, then one of the field arguments must be continue or you must specify a default_option, which corresponds to one of the select choices begin presented. This is necessary if advancing within the application, for while the message will not be displayed, the logic will be evaluated, and CSPro needs to know where to go. See below for an example on this usage. If the system is not processing an advance, using default_option places the focus on the select option chosen when the message is presented. If a default_option is not given, no button will have the focus.
If you wish to split message text across two or more lines, refer to the Message Formatting Options page.
Return Value
The function returns the cardinal number of the button pressed. When the select keyword is not used, the function will return 1, as only the "OK" button is presented to the user, corresponding to button #1 ("Cancel" is never presented, and so a code of zero is not possible).
When the select keyword is used, the function returns the sequence number of the button that was pressed, with the first button having the value 1. A maximum of 5 select argument pairs is allowed.
Example
PROC MARITAL_STATUS

   
if curocc() > 1 and MARITAL_STATUS in 1, 2 /* married, partner */ and SEX = SEX(HEAD) then
       
warning("Is the sex of this person the same as that of the head of household?")
       
select("Correct", continue,
               
"Incorrect: Change this person's sex", SEX,
               
"Incorrect: Change the head's sex", SEX(HEAD))
       
default(1); // during an advance, use the first choice: continue;
                    // if not processing an advance, the focus will be on button 1
    endif;
See also: ErrMsg Function, Message Formatting Options, InAdvance Function