• <Helps for GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
        • Compress Function
        • Decompress Function
        • Diagnostics Function
        • Encode Function
        • ErrMsg Function
        • ExecSystem Function (Desktop)
        • ExecSystem Function (Mobile)
        • ExecPFF Function
        • GetProperty Function
        • GetLabel Function
        • GetLanguage Function
        • GetSymbol Function
        • GetValueLabel Function
        • Hash Function
        • HtmlDialog Function
        • InValueSet Function
        • Invoke Function
        • IsChecked Function
        • LoadSetting Function
        • LogText Function
        • MaxValue Function
        • MinValue Function
        • Paradata Function
        • PathConcat Function
        • PathName Function
        • Report Function (Deprecated)
        • SaveSetting Function
        • SetLanguage Function
        • SetProperty Function
        • SetReportData Function (Deprecated)
        • SetValueSet Function
        • SetValueSet Function With Arrays
        • SetValueSets Function
        • Special Function
        • SqlQuery Function
        • Stop Function
        • SysParm Function
        • Tr Function
        • Trace Function
        • UUID Function
        • View Function
        • Warning Function
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
      • Export Attributes
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Appendix
  • <Helps for CSEntry>
  • <Helps for CSBatch>
  • <Helps for CSTab>
  • <Helps for DataViewer>
  • <Helps for TextView>
  • <Helps for TblView>
  • <Helps for TRSWin>
  • <Helps for CSDeploy>
  • <Helps for CSPack>
  • <Helps for CSFreq>
  • <Helps for CSSort>
  • <Helps for CSExport>
  • <Helps for CSReFmt>
  • <Helps for CSDiff>
  • <Helps for CSConcat>
  • <Helps for TRSSetup>
  • <Helps for ParadataViewer>
  • <Helps for ParadataConcat>
  • <Helps for CSIndex>
  • <Helps for Excel2CSPro>
  • <Helps for CSWeb>

View Function

Format
b = view(filename ‖ website_address ‖ object_nameʃ, optional_named_argumentsʅ);
Description
The view function displays the contents of a file or shows a website. The function expects a string expression representing a file (filename) or a website URL (website_address), or a CSPro object (object_name) such as a document, freq, image, or report. If a website URL or a file with the extension .html or .htm is provided, it is shown in an embedded window. For other files, an external application is launched to display the file using the system's default viewer for that file type.
HTML files or websites are displayed in an embedded window using a Chromium-based web browser (Edge WebView2 on Windows; WebView on Android). In this web browser, it is possible to use the JavaScript interface to run user-defined functions or to execute other CSPro operations.
Optional named arguments can be used to control how the embedded web browser displays on Windows:
  • title := string expression giving the title of the window.
  • width := numeric expression specifying the width of the window in display units.
  • height := numeric expression specifying the height of the window in display units.
  • showCloseButton := conditional expression that, if false, hides the window's Close button.
If either the height or width is specified, then both values have to be provided. Hiding the Close button also removes the margin around the web browser, so the browser will fill the entire embedded window.
Return Value
The function returns a logical value of 1 (true) if the file exists and the external application or embedded web browser could be launched successfully and 0 (false) otherwise.
Examples
view("https://www.census.gov/data/software/cspro.html");

view("../Nineties Images/carn03.jpg");

view("hh-report.html", title := "Household Completion Report",
                       width := 
400, height := 600,
                       showCloseButton := 
false);
See also: ExecSystem Function (Desktop), ExecSystem Function (Mobile), HTML in CSPro, JavaScript Interface