• <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
        • Assignment Statement
        • Recode Statement
        • Recode Statement (Deprecated)
        • Impute Function
        • SetValue Function
        • GetValue Function
      • 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
    • 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>

GetValue Function

Formats
d = getvalue(variable_nameʃ, occurrence1, ..., occurrence3ʅ);

d = 
getvaluenumeric(variable_nameʃ, occurrence1, ..., occurrence3ʅ);

s = 
getvaluealpha(variable_nameʃ, occurrence1, ..., occurrence3ʅ);
Description
The getvalue function returns the value of a variable when the variable name is not known at compilation time (when writing the application). The function searches for a variable with a name stored in the string expression variable_name, and if such a variable is found, the function returns the value of that variable.
The functions getvalue and getvaluenumeric return the value of numeric variables. The function getvaluealpha returns the value of an alphanumeric variable. Optional arguments, occurrence1 to occurrence3, allow you to pass occurrence numbers to the function.
Return Value
The function returns the variable's value if the variable name was found. If a numeric variable was not found, the functions getvalue and getvaluenumeric return default. If an alphanumeric variable was not found, getvaluealpha returns a blank string.
Example
errmsg("The current field's value is %d", getvalue(getsymbol()));
See also: SetValue Function