Adding WebDAV Graph Portlets

Overview of Adding WebDAV Graph Portlets

A WebDAV graph portlet creates and displays a line graph, a bar chart, or a pie chart of data that is stored in a WebDAV repository. After you add properly formatted XML data files to the WebDAV repository, you can create and share WebDAV graph portlets that provide particular views of those data files. All portal users can create their own WebDAV graph portlets.
The following steps explain how to create XML data files and add them to the WebDAV repository, and how to create and share WebDAV graph portlets.

Step 1: Prepare the Data Set That You Want to Graph

Developers in your organization must provide a valid SAS data set to use for the WebDAV graph. The developer should understand your organization's data models and should have SAS programming experience.
Often, you can use a SAS data set without any modifications. Other times, you might want to subset a SAS data set, or perform summary statistics. In general, the simpler the data (more processing that is completed by using the SAS programming language), the easier it is to display a graph in the SAS Information Delivery Portal. For storage and performance reasons, it is preferable to presummarize a large data set (one that has 5000 or more entries). In addition, a summary report is very appropriate for achieving a dashboard effect that enables users to see important information at a glance.

Step 2: Create an XML File and Add It to WebDAV

The SAS Information Delivery Portal provides a macro that creates a properly formatted XML file from your SAS data set, and adds the XML file to the WebDAV repository. The XML file uses the standard SAS Report Model format that is used by other SAS applications, such as SAS Web Report Studio. The macro provides additional formats and labels that the WebDAV graph portlet requires in order to generate a graph.
To create and add the XML file, follow these steps:
  1. Create a SAS program that invokes the publishToWebDAV macro. The macro file is located in the SAS-configuration-directory\Lev1\Web\Applications\SASPortal4.3\sasJobs directory.
  2. In your SAS program, when you invoke publishToWebDAV, you must pass a set of arguments that specify the name of the SAS data set, the WebDAV location, and the credentials that are required to write to that location. The publishToWebDAV syntax is described after these steps.
  3. Save and run the SAS program.
If there are any DBCS characters in the parameters (for example, davloc) the publishToWebDAV macro must run in a language-specific SAS environment. Another option is to save the SAS program in UTF-8 format, and use the Batch Submit with SAS 9.3 (UTF8) program to run the job.
The publishToWebDAV macro creates an XML file named data.xml in the WebDAV location that you specified.
Note: If you later update the SAS data set, you must run the macro again to re-create the data.xml file in order to see those updates in WebDAV graph portlets.
Here is the syntax for the publishToWebDAV macro:
%publishToWebDAV (sasdsn, davloc, userid, passwd)
All parameters are required in order to create and publish the XML file. Here are descriptions of the parameters:
sasdsn
Specify the full name of the SAS data set, in the format libref.SAS-data-set, and enclosed in single quotation marks. For example: 'sashelp.class'
davloc
Specify the URL for the WebDAV location, enclosed in single quotation marks. For example: 'http://<WebDAVHost>:8080/SASContentServer/repository/default /sasdav/Users/sasdemo/graph1'
In this example, the macro creates a graph1 directory under sasdav/Users/sasdemo on the WebDAV server, and creates an XML file named data.xml in that directory.
Be sure to specify a unique location for each data set to be published. If the location that you specify already exists on the WebDAV server, you will overwrite the existing XML file.
The macro does not create nested directories within the parent directory. If you want nested directories, create the directory structure before running the macro.
For example: 'http://<WebDAVHost>:8080/SASContentServer/repository/default /sasdav/graph1/ClassData'
The top level WebDAV directory (sasdav) should already exist. The intermediate directory (graph1) must be manually created before running this macro. The parent directory (ClassData) is automatically created by this macro if the directory does not exist. If it already exists, the parent directory (and its contents) are removed and the directory is re-created.
user ID
Specify the user ID that is used to connect to the WebDAV server, enclosed in single quotation marks. If the WebDAV server runs on a Windows system, the user ID for an external user (for example, a user defined on the host system) should be qualified with either the domain name or the machine name. For example: <machine or Windows domain>\'sasdemo'
The user ID that you specify must be authorized to write to the WebDAV location that is specified for the davloc parameter.
passwd
Specify the password that is used to authenticate the user that you specified in the previous argument, enclosed in single quotation marks. It is recommended that you encrypt the password, but you are not required to do so.
Use SAS proprietary 32-bit encryption to encrypt passwords. For example, to encrypt a password of SASDemo1, submit this code in the SAS Program Editor: proc pwencode in='SASDemo1' method=sasenc; run;
The encrypted password is written to your SAS log. When you use method=sasenc, the first part of the password is {sasenc}.
Here is a sample SAS program that includes and invokes the publishToWebDAV macro:
%include 'publishToWebDAV.sas';
%publishToWebDAV('sashelp.class',
 'http://localhost:8080/SASContentServer/repository/default/sasdav/graph1/ClassData',
 'sasadm@saspw', '{sasenc}E19F24391F7B576C45200E543F0B37B4');

Step 3: Create and Share a WebDAV Graph Portlet

After you have successfully completed Step 2, you can create and share a WebDAV graph portlet.
Here is a summary of the steps that are required to create and share a WebDAV graph portlet. For complete instructions, see the online Help that is provided with the SAS Information Delivery Portal:
  1. Verify that a permissions tree folder exists for the group with which you want to share the portlet. If necessary, create a permissions tree folder. For more information, see Managing Portal Permission Trees in Metadata .
  2. Log on to the portal as a group content administrator (in order to share the portlet with the respective group).
  3. Create the WebDAV graph portlet. You can create a new portlet and add it to a page, create a new portlet independently of a page, or add an existing portlet to a page.
  4. Edit the contents of the portlet in order to specify the location of the XML data file and other properties. You can specify the following properties:
    • the type of graph or chart that is to be created (line graph, bar chart, or pie chart).
    • the size of the graph or chart (small, medium, or large).
    • a title and a description.
    • the data variables that are used for the horizontal and the vertical axes. You can also specify a subcategory variable to provide more detail for the horizontal axis.
    • a statistic that is to be calculated based on the response variable (the variable that is used for the vertical axis). If you do not choose a statistic from the list that is provided, Sum is used as the default statistic.
    • a link to detailed information. If you want the portlet to display a link to other information, such as a SAS report or a stored process, enter the path for the link. The target file can be stored in SAS metadata or in the portal's WebDAV repository.
      Create the path for a link for a metadata-based object (all objects except files and WebDAV packages):
      METASERVER/+Products/SAS Intelligence Platform/Samples+/+Sample:Hello World
      The following example illustrates a location in metadata for the file SAS_Email_Message.html:
      WebDAV/Templates/notification/en
      Adding the two items results in WEBDAV/Templates/notification/en/SAS_Email_Message.html.
      Note: To determine the path, you can search for the file in the portal. (To find a WebDAV file, search on the Files category.) The path is displayed in the search results. If you share the WebDAV graph portlet with a group of users, make sure that the group has permissions to access the target file.
    For complete descriptions of the preceding properties, see the online Help that is provided with the portal.
  5. Edit the properties of the portlet in order to share the portlet with a group of portal users. When you share the portlet with a group, only members of that group can access the portlet.
    Note: In order to view the graph, group members must have read permissions for the XML file that you created on the WebDAV server.
If you have added XML data files to the WebDAV server, all portal users can create WebDAV graph portlets and add those portlets to their pages by using the portal Customize menu. The group content administrators can use the portal Customize menu to create portlets. In either case, only users who are authorized as an administrator for a group can share a portlet with the group or edit a shared portlet.