• <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 DB
      • Encrypted CSPro DB
      • Text
      • JSON
      • None
      • In-Memory
      • Comma Delimited (CSV)
      • Semicolon Delimited
      • Tab Delimited
      • Excel
      • R
      • SAS
      • SPSS
      • Stata
      • CSPro Export
      • Case Read Optimization
    • 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>

Text Data Source

Overview
The Text data source allows reading and writing data to a text file. Items are written positionally, using fixed widths. This data source is versatile and can read data from other applications, as long as the data can be described by a CSPro dictionary, with records specified on multiple lines and items specified positionally. Stating in CSPro 7.0, the CSPro DB data source became the default data source for CSPro, and because that data source has more functionality than Text, you are encouraged to use that format when possible.
For a description of how cases are represented in text format, see Data File Type Structure.
The Text data source is used when a file has the extension .dat, or when it has an extension not associated with another data source. In other words, most extensions will map to a Text data source.
Functionality
The Text data source supports the following features:
FeatureSupported
Reading cases
✔
Writing cases
✔
Notes, case labels, and case statuses
✔
Storage of more than one kind of record
✔
Binary data items
✘
Deleting cases
✔
Undeleting cases
✘
Syncing data
✘
Cases with duplicate keys
✘
Case identification via UUID
✘
Contains an embedded dictionary
✘
Allows record sorts
✔
Associated Files
The Text data file only contains information about the data as defined by a dictionary. Associated case data is written to the following files:
  • Notes: Notes entered by the operator are written to a text file with the extension .csnot.
  • Statuses: Information such as whether a case has been partially saved or verified is written to a text file with the extension .sts. The file also contains information about case labels.
  • Index: The index stores information about where cases are located in the data file, allowing CSPro to quickly lookup cases. Because the index is a SQLite database, it is possible to query the index using SQL statements.
Special Character Handling
Because newlines are used to indicate the start of a new record, if a value contains a newline, the value must be escaped before writing. The '␤' character is used to indicate a newline when writing data or writing entries to the notes and status files. For example, a value like "Line 1\nLine 2" would be written as:
Line 1␤Line 2
Customizable Behavior
The following behavior can be customized by specifying properties in the connection string. The default behavior is marked with ⁺⁺⁺.
Property Name and ValuesDescription
 
"cache"Determines if cases are cached in memory. This may be useful to advanced users who want to optimize programs that do a lot of case lookups.
true
Cases are cached, meaning that a case is only read from the data source once.
false ⁺⁺⁺
Cases are not cached.
For example, the following connection string, specified in a data entry PFF, would attach to an external dictionary a Text file with caching enabled:
CENSUS_2024_DICT=.\Census.dat|cache=true
See also: Data Sources, Data File Type Structure