b = view(file_name ‖ website_url ‖ object_nameʃ, viewer_argumentsʅ);
The first argument to the function indicates what to view:
- file_name (string expression): The contents of the file are displayed, either in an embedded web browser, or using the system's default viewer for that file type. For example, if an Excel document is referenced, the function will open the document in Excel. However, if a HTML document is referenced, it will be shown in an embedded web browser. Documents are considered HTML if they have one of the following extensions: .html, .htm, or .cshtml.
- website_url (string expression): An embedded web browser is used to display the website.
- object_name: The contents of the object are displayed, generally in an embedded web browser. Passing an object to the view function is identical to calling the view function on the object using dot notation. For example, the following calls are identical:
The following objects support viewing: Case, Document, Freq, Image, and Report.
If an embedded web browser is used, any logic coded after the
view function call will not execute until the window is closed. However, if a separate application is launched, the application will continue while the external application is still active.
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 must be provided. Hiding the Close button also removes the margin around the web browser, so the browser will fill the entire embedded window.
The function returns a logical value of
1 (
true) if the file exists, or the object has data, and the embedded web browser or external application was launched successfully, and
0 (
false) otherwise.
// provide the URL of a website as a string
view("https://www.census.gov/data/software/cspro.html");
// provide the name of a local HTML file as a string
view("hh-report.html", title := "Household Completion Report",
width := 600, height := 400,
showCloseButton := false);
// provide the name of a local image file as a string
view("../Nineties Images/carn03.jpg");
// provide the dictionary name to see its case contents
view(CENSUS_DICT);