• <GetStart>
  • CSPro User's Guide
    • The CSPro System
      • What is CSPro?
      • CSPro Capabilities
      • Release History
      • What's New in CSPro?
      • CSPro Applications
        • Data Entry Applications
        • Batch Edit Applications
        • Tabulation Applications
        • Data Dictionary
        • Forms Design
        • Tool List
        • CSPro URIs
      • CSPro General Concepts
      • CSPro General Functionality
      • How To ...
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • Synchronization
    • CSPro Statements and Functions
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

CSPro URIs

Overview
Uniform Resource Identifiers (URIs) provide a standardized way to identify and access resources. They typically follow the structure scheme://resource, where the scheme indicates how the resource should be interpreted or handled. Some widely used schemes include https for web resources and mailto for email messages.
CSPro uses a URI with the custom scheme cspro. A CSPro URI does not use an authority. The first part of the resource path is a description, or action, with the following options:
  • /data: Identifies a data source. This can be used in places where a data connection string is expected.
  • /sync: Identifies a synchronization service. This can be used in places where a synchronization connection string is expected.
  • /text: Identifies a text file.
  • /cache: Identifies binary data cached by the Action Invoker.
Beyond the scheme, empty authority, and path, a CSPro URI can contain properties specified as a query string. If creating a query string dynamically in logic, you can use the encode function with the URIComponent argument.
A tool, CSPro URI Handler, is distributed with the CSPro suite and registered with Windows so that URIs that begin with cspro:// are handled by CSPro. URIs that begin with the path /data are opened in Data Manager and URIs that begin with /text are opened in Text Viewer.
Data CSPro URIs
CSPro URIs with a path beginning in /data can be used as data connection strings. For example, the following two statements result in identical behavior:
setfile(HOUSING_DICT, "housing.json|writeLabels=true");

setfile(HOUSING_DICT, "cspro:///data/housing.json?writeLabels=true");
On Windows, data CSPro URIs are opened in Data Manager. For example, if the CSPro examples are installed in the directory C:\cspro-examples\, the following URI would open the Popstan Census data file:
cspro:///data/C:/cspro-examples/Popstan%20Census/Popstan%20Census.dat
The following defines a property, specified as a query string, so that Data Manager does not ask for a dictionary to describe the Text data source, and further gives the key (case IDs) of a case to open.
cspro:///data/C:/cspro-examples/Popstan%20Census/Popstan%20Census.dat?dictionaryPath=Census%20Dictionary.dcf&key=010117100110870031
Sync CSPro URIs
CSPro URIs with a path beginning in /sync can be used as sync connection strings. For example, the following two statements result in identical behavior:
syncconnect("https://example.org/csweb/api|username=islands&password=violet")

syncconnect("cspro:///sync/https://example.org/csweb/api?username=islands&password=violet")
Text CSPro URIs
On Windows, CSPro URIs with a path beginning in /text are opened in Text Viewer. For example, pasting this URL in File Explorer or a web browser will open the readme.txt file located in the CSPro installation folder.
cspro:///text/C:/Program%20Files%20(x86)/CSPro%208.1/readme.txt
See also: Connection String