• <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
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
      • Overview
      • Execution Environments
      • Security, Resource Management, and Formatting Options
      • Base Actions
      • Application Namespace
      • Clipboard Namespace
      • Data Namespace
      • Dictionary Namespace
      • File Namespace
      • Hash Namespace
      • Localhost Namespace
      • Logic Namespace
        • Logic Action Invoker Namespace
        • Logic.eval Action
        • Logic.getSymbol Action
        • Logic.getSymbolMetadata Action
        • Logic.getSymbolValue Action
        • Logic.invoke Action
        • Logic.setSymbolValue Action
      • Message Namespace
      • Path Namespace
      • Settings Namespace
      • Sqlite Namespace
      • System Namespace
      • UI Namespace
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Logic.getSymbol Action

Format
s = CS.Logic.getSymbol(name := ...ʃ, serializationOptions := ...ʅ)
ArgumentDescriptionTypes / Required
nameThe name of the symbol.string
required
serializationOptionsOptions for how the symbol should be serialized.object
not required
Description
The Logic.getSymbol action returns the JSON representation of the metadata and value of the symbol with the specified name. The optional serializationOptions argument allows you to specify how the symbol should be serialized, potentially overriding the default application settings.
You can use the Logic.getSymbolMetadata action if you only want to work with the symbol's metadata, or Logic.getSymbolValue if you only want the symbol's value. You can also use the Symbol.getJson function to get a symbol's JSON metadata and value.
All symbols support the serialization of the symbol metadata. The following table describes the value-related serialization routines available for CSPro objects and contains links to the description of the JSON representation for each object.
Documentation about all JSON representations feature will come in a future release.
ObjectValue -> JSONJSON -> ValueSerialization
numeric✔✔CSPro ⇄ JSON Conversions: Numeric Values
string, alpha✔✔CSPro ⇄ JSON Conversions: String Values
Array✔✔CSPro ⇄ JSON Conversions: Array Object
Audio✔✔CSPro ⇄ JSON Conversions: Audio Object
Block
Dictionary✔
Document✔✔CSPro ⇄ JSON Conversions: Document Object
File✔
Freq✔
function
Geometry✔✔CSPro ⇄ JSON Conversions: Geometry Object
HashMap✔✔CSPro ⇄ JSON Conversions: HashMap Object
Image✔✔CSPro ⇄ JSON Conversions: Image Object
Item
List✔✔CSPro ⇄ JSON Conversions: List Object
Map
Pff
Record
Report✔✔CSPro ⇄ JSON Conversions: Report Object
StringWriter✔✔CSPro ⇄ JSON Conversions: StringWriter Object
SystemApp✔✔
ValueSet✔✔
Return Value
The action returns an object with the symbol's metadata and, if applicable, the JSON representation of the value.
Exceptions
The action throws an exception if any of its arguments are not specified in a valid form or if no symbol has the specified name.
Example (JavaScript)
// proceed only if the dictionary is the main input dictionary and a case exists
const precipitationDict = CS.Logic.getSymbol({
    name: 
"PRECIPITATION_DICT"
});

if( precipitationDict.type != "Dictionary" || precipitationDict.dictionaryType != "input" ) {
   
throw new Error(`${precipitationDict.name} is not the main dictionary.`);
}

if( precipitationDict.value == undefined || precipitationDict.value.case == undefined) {
   
throw new Error(`${precipitationDict.name} is not currently associated with a case.`);
}
See also: Logic Action Invoker Namespace, Logic.getSymbolMetadata Action, Logic.getSymbolValue Action, Logic.setSymbolValue Action, Symbol.getJson Function