• <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
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
      • Overview
      • Execution Environments
      • Security and Formatting Options
      • Base Actions
        • execute Action
        • registerAccessToken Action
      • Application Namespace
      • Clipboard Namespace
      • Data Namespace
      • Dictionary Namespace
      • File Namespace
      • Hash Namespace
      • Localhost Namespace
      • Logic Namespace
      • Message Namespace
      • Path Namespace
      • Settings Namespace
      • Sqlite Namespace
      • System Namespace
      • UI Namespace
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

execute Action

Format
s = CS.execute(action := ...ʃ, arguments := ...ʅ)
ArgumentDescriptionTypes / Required
actionThe name of the action to execute.string
required
argumentsArguments for the action.object
not required
Description
The execute action executes another action with the action name specified as a string argument action. Action names are specified without the prefix "CS.", e.g., "Clipboard.getText" for Clipboard.getText. If the action to be called requires arguments, they can be forwarded to the action using arguments.
Although execute can be used to execute any action, generally you will want to call the action directly. However, execute provides a generalized framework for executing actions by calling a single action as an entry point. A related action, Localhost.mapActionResult, executes an action and maps the result as a localhost URL.
Return Value
The action returns the result of the other action executed.
Exceptions
The action throws an exception if any of its arguments are not specified in a valid form, if the action name is not valid, or if the other action executed throws an exception.
Example (CSPro Logic)
// calling an action directly
string clipboardText = CS.Clipboard.getText();

// calling an action indirectly
clipboardText = CS.execute(action := "Clipboard.getText");
Example (JavaScript)
// calling an action directly
let birdHash = CS.Hash.createHash({
    text: 
"Eurasian Hoopoe",
    salt: 
"Bucerotiformes",
    saltFormat: 
"text"
});

// calling an action indirectly
birdHash = CS.execute({
    action: 
"Hash.createHash",
    arguments: {
        text: 
"Eurasian Hoopoe",
        salt: 
"Bucerotiformes",
        saltFormat: 
"text"
    }
});
See also: Action Invoker Overview, Localhost.mapActionResult Action