Publishing Framework
How to Apply a ViewerAfter 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 ViewerFor 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 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:
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 ViewerFor 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. |