• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
      • Introduction to CSPro Language
      • Data Requirements
      • CSPro Program Structure
      • Programming Standards
      • Code Folding
      • Debugging CSPro Applications
      • Declaration Section
        • Compiler Mode
        • Variables
        • Alias Statement
        • User-Defined Functions
        • Array Object
        • Audio Object
        • Case Object
        • Document Object
        • File Object
        • Freq Object
        • Geometry Object
        • HashMap Object
        • Image Object
        • List Object
        • Map Object
        • Pff Object
        • SystemApp Object
        • ValueSet Object
      • Procedural Sections
      • Logic
      • Language Elements
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and 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>

Document Object

In logic, a Document object facilitates the storage of text or binary files. Unlike CSPro data files, or text files (accessed via File), the contents of a Document cannot be directly edited.
Functionality
A Document object is a CSPro logic object that can be defined as a binary dictionary item or created as a logic variable. The following functions can be called via dot notation:
FunctionDescription
loadReads a file and stores its contents in the Document object.
saveWrites the contents of the Document object to a file.
viewDisplays the contents of the file held by the Document object.
clearClears the Document object's contents.
 
getLabelReturns the symbol's label.
getNameReturns the symbol's name.
getJsonReturns the symbol's metadata and value represented in JSON.
getValueJsonReturns the symbol's value represented in JSON.
updateValueFromJsonModifies the symbol based on a JSON representation of the value.
In addition to these object functions, Document objects can be used as arguments to the filename and view functions.
Assignments
Document objects can be assigned to other Document objects, which will replace the Document's contents with the contents from the assigned Document object.
document_name = another_document_name;
It is also possible to assign Audio, Geometry, and Image objects to a Document. These assignments will always succeed.
document_name = audio_name;
document_name = geometry_name;
document_name = image_name;
You can also make the reverse assignment, assigning a Document to an Audio, Geometry, or Image object. A runtime error will occur if the Document's data cannot be converted to those objects.
audio_name = document_name;
geometry_name = document_name;
image_name = document_name;
You can assign a string expression to a Document object, which will replace the Document's contents with the text, as if the contents had been read from a text file.
document_name = "string expression";
When a Document is used as an argument to a user-defined function, it is passed by reference.
Example
Document manual;
manual.
load("Farmers Markets Survey.pdf");
manual.
view();
See also: Audio Object, Geometry Object, Image Object