• <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
      • 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
        • System Action Invoker Namespace
        • System.getSharableUri Action
        • System.selectDocument Action
        • Sharable URI
      • 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>

Sharable URI

In CSPro, a sharable URI is a way to reference files in a way that works across applications that are not part of the CSPro ecosystem. The primary use for sharable URIs is to share them with other Android applications so that those applications can access data or files in the gov.census.cspro.csentry directory. The way that sharable URIs look depends on the operating system:
On Windows, a sharable URI is the same as a file path. For example:
C:\AMO\Chautauqua-5K-results.pdf
On Android, a sharable URI is a content URI. For example:
content://gov.census.cspro.csentry.fileprovider/root/storage/emulated/0/Android/data/gov.census.cspro.csentry/files/csentry/AMO/Chautauqua-5K-results.pdf
In CSPro you can work with sharable URIs using the Action Invoker in the following ways:
ActionDescription
System.getSharableUriCreate a sharable URI that can be used by external applications to reference a file.
System.selectDocumentRetrieve a sharable URI for one or more documents shared by the system.
File.copyCopy a file specified using a sharable URI.
Example (CSPro Logic)
// query for an image
string selectDocumentJson = CS.System.selectDocument(contentType := "image/*");

if selectDocumentJson <> "" then
   
// convert the JSON into a CSPro-usable format using a HashMap
    HashMap string selectDocumentResult;
    selectDocumentResult.
updateValueFromJson(selectDocumentJson);

   
// create the new image path, using the original filename
    dircreate("Images");
   
string imagePath = Path.concat("Images", selectDocumentResult("name"));

   
// copy the document to the Images directory
    CS.File.copy(source := selectDocumentResult("path"),
                 
destination := imagePath);
endif;
See also: Interacting With Other Android Applications, System Action Invoker Namespace