• <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
      • Numeric Values
        • JSON Representation
        • JavaScript Representation
      • String Values
      • 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
      • StringWriter 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
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

CSPro ⇄ JavaScript Conversions: Numeric Values

A CSPro numeric value, created as a numeric or as part of an object such as a List, is generally represented as a JavaScript number. However, special values are serialized as follows:
CSPro ValueJavaScript TypeJavaScript Value
notapplnullnull
missingstring"MISSING"
refusedstring"REFUSED"
defaultstring"DEFAULT"
Note that notappl is serialized as the string "NOTAPPL" in JSON but as null in JavaScript.
When converting a JavaScript value to a CSPro numeric, the following conversions are supported:
JavaScript TypeJavaScript ValueCSPro Value
number—number
booleantrue1
booleanfalse0
nullnullnotappl
string"NOTAPPL"notappl
string"MISSING"missing
string"REFUSED"refused
string"DEFAULT"default
The strings representing special values are processed in a case-insensitive manner. For example, both "MISSING" and "miSSing" are converted to missing.
Converting a string that contains a number succeeds as long as the number is not followed by a non-number. That is, "40" is converted to 40 but "40 days" results in an exception.
Converting an array containing a single value succeeds, but an exception occurs if the length of the array is not 1. For example, [ 1979 ] is converted to 1979 but [ 1979, 1982 ] results in an exception.
Converting an object or undefined results in an exception.
See also: CSPro ⇄ JavaScript Value Conversions, CSPro ⇄ JSON Conversions: Numeric Values