Passing Parameters into a SAS Visual Analytics Report
SAS Visual Analytics reports are accessed via the Report Viewer application in a web browser and it is possible to access a specific report by using the correct URL.
Some reports use parameters as a means of providing interactivity to the report for the consumer. Usually, the parameter values are set interactively by the report consumer using controls within the report, however, it is possible to set values for these parameters via the report URL. This enables, for example, custom filters to be applied or dynamic calculations to be performed as the report is opened, saving the consumer time as they do not have to set the parameter values themselves interactively.
This tip will demonstrate how to form a URL to open a VA report and provide parameter values.
Building a URL to Open a Visual Analytics Report
The URL for a SAS Visual Analytics report requires at least three inputs to be specified by the creator. There are optional extra parameters that can be added to further personalise the report when it opens.
The basic URL is compiled as follows;
- Host – This will be particular to your SAS Visual Analytics environment and can be obtained from your SAS Administrators.
- reportPath – This parameter specifies the location in which the report is saved, within the SAS Folders Tree. The URL above would open a report saved in the Shared Data folder.
- reportName – This parameter specifies the name of the report to open. The URL above would open a report named Report 1.
Each of the parameters must be joined with an ampersand symbol and the URL needs to be written with HTML URL encoding. If the reportName or reportPath include special characters, they will need encoding. Common character encodings are as follows:
The basic URL can be extended to tailor the view of the report when it is opened, by adding more parameters:
- Add &reportViewOnly=true and &appSwitcherDisabled=true to remove the banners at the top of the screen, and remove the ability to navigate away from the report viewer respectively.
- Add both &propertiesEnabled=false and &commentsEnabled=false to completely remove the Right Pane from the report.
Personalise the URL to Pass Parameters Into a VA Report
A control object in a report allows the viewer to select a value from a list to filter the report that they are viewing. The value selected in a control object can also be determined using parameters in the URL.
An example use of this would be an email distribution of a report that has a Report Prompt filter for Country. The report viewers in each country would, by default, want to view the report filtered by their own country. The country in which the recipient works can be added as a parameter in the URL so that they don’t need to select it when they open the report.
The steps to achieve this are highlighted below:
1. Create a parameter in the report
2. Assign the parameter to the control object in the report (this can be done in the Roles tab)
3. Compile the URL to be emailed to users.
The parameter name and value need to be added to the basic URL. As such, so to open a report showing only data for England, add &CountryParameter=England to the end of the URL: