• <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>

savesetting Function

Format
b = savesetting(attribute, value);
Description
The savesetting function saves a setting as an attribute-value pair using the string expression attribute and the string or numeric expression value. You can save multiple settings using different attribute strings and can retrieve the settings using the loadsetting function. These settings are stored locally on the device and can be accessed by other programs using the attribute string. Using settings is a way to share data between different CSPro applications on the same device.
The file from which settings are retrieved can be modified by altering the CommonStore attribute of a PFF file.
All settings can be cleared using the following command: savesetting(clear);
Settings can also be set using the Settings.putValue action. The persistent variable modifier can also be used to serialize settings across application runs.
Return Value
The function returns 1 (true) if successful or 0 (false) if the function failed.
Example
PROC INTERVIEWER_NAME

preproc

   
string InterviewerNameKey = "InterviewerName";

    INTERVIEWER_NAME = 
loadsetting(InterviewerNameKey);

postproc

   
if strip(INTERVIEWER_NAME) = "" then
       
errmsg("You must enter the interviewer's name.");
       
reenter;
   
endif;

   
savesetting(InterviewerNameKey, INTERVIEWER_NAME);
See also: loadsetting Function, Settings.putValue Action, User and Configuration Settings, persistent Variable Modifier, CSEntry Settings Modification