SAS 9.1.3 Integration Technologies » Developer's Guide


Viewer Processing
Usage
When to Use a Viewer
How to Create a Viewer
How to Apply a Viewer
Reference
SASINSERT Tag
Substitution Syntax
SASTABLE Tag
SASREPEAT Tag
SASECHO Tag
Examples
Using the SASINSERT and SASTABLE Tags
Sample HTML Viewer
SAS Program with an HTML Viewer
Sample Viewer Template
Publishing Framework

How to Apply a Viewer

After you create a viewer template for a package, the publisher can apply it when publishing the package to e-mail using the following methods:

Using SAS Publisher to Apply a Viewer

For the e-mail, channel subscriber, and WebDAV transports only, you can specify a viewer in the appropriate transport type tab. Here is an example of completed viewer properties:

viewer options
Viewer Field in the How Viewer Referenced Group Box

You specify the location of the viewer in the form of either a physical filename (for example, c:\Public\viewtemplate.html or c:\Public\viewtemplate.txt) or a SAS fileref (for example, template).

Specify a file name extension that is appropriate to the type of template that is to be used:

  • .HTML
  • .TXT

Arrow buttons are provided to the right of the Viewer field, allowing you to browse directories or to select from previously defined locations.

Regardless of the selection for viewer reference, leaving the Viewer field blank causes optional viewer properties to be ignored.

For more information about how to complete viewer options in the Where to Publish SAS Publisher tab, see Specifying Package Format.

Using the Publish Package Interface to Apply a Viewer

For the e-mail, channel subscriber, and WebDAV delivery types only, you specify a viewer as a property to the PACKAGE_PUBLISH SAS CALL routine.

You specify the VIEWER_NAME property and assign to it a viewer in the form of either an external filename or a SAS fileref.

For example, the following code shows the application of an HTML viewer to a package that is published to e-mail:

   publishType = "TO_EMAIL";
      properties = "VIEWER_NAME";
      viewerFile = "filename:c:\dept\saletemp.html";
      emailAddress = "JohnDoe@alphalite.com";
      Call package_publish(pid, publishType, rc, 
         properties, viewerFile, emailAddress);
   

The following code shows the application of a text viewer to a package that is published to e-mail:

   publishType = "TO_EMAIL";
      properties = "TEXT_VIEWER_NAME";
      viewerFile = "filename:c:\dept\saletemp.txt";
      emailAddress = "JohnDoe@alphalite.com";
      Call package_publish(pid, publishType, rc, 
         properties, viewerFile, emailAddress);
   

The following code publishes the package (to which an HTML viewer is applied) to all subscribers of the HR channel. The subject property is specified so that all e-mail subscribers will receive the message with the specified subject.

   pubType = "TO_SUBSCRIBERS";
   storeInfo = 
      "LDAP://alpair02.unx.com:8010/o=Alphalite Airways,c=US";
   viewerFile = "filename:c:\dept\saletemp.html";
   channel = 'HR';
   subject = "Weekly HR Updates:";
   props = "VIEWER_NAME, SUBJECT, CHANNEL_STORE";
   CALL PACKAGE_PUBLISH(packageId, "TO_SUBSCRIBERS", rc, 
      props, viewerFile, subject, storeInfo, channel);

The following code publishes the package (to which an HTML viewer is applied) to a WebDAV-compliant server.

   rc = 0;
   pubType = "TO_WEBDAV"
   subject = "Nightly Maintenance Report"
   properties= "VIEWER_NAME, COLLECTION_URL"
   viewerFile = "filename:c:\dept\saletemp.html"
   cUrl = "http://www.alpair.web/NightlyMaintReport"
   CALL PACKAGE_PUBLISH(packageId, pubType, 
      rc, properties, viewerFile, cUrl);

For complete details about how to programmatically specify a viewer when you publish to the e-mail and the channel subscriber types, see PACKAGE_PUBLISH CALL routine syntax.