SAS Viya SDK for JavaScript
The SAS Viya SDK for JavaScript is a collection of JavaScript libraries for interfacing with SAS Viya resources and embedding your SAS Viya content into custom web pages and corporate portals.
Getting Started
The individual JavaScript libraries are located in package folders at /sdk
. The README for each package contains links to documentation and examples that will help to get started.
Installation
SAS Viya SDK for JavaScript library packages can be installed from npm or loaded directly from the SAS Developer CDN.
Package installation steps for each library are included in its README.
The libraries can be loaded directly from the SAS Developer CDN using the HTML script tag:
<script async src=https://cdn.developer.sas.com/packages/${PACKAGE-NAME}/${VERSION}/${FILE-PATH}></script>
Examples
Examples for each library can be found in /examples
in the corresponding package folder at /sdk
.
Need help?
- For documentation, guides and API references, see developer.sas.com
- File an issue with GitHub Issues
- Visit the SAS Community resources
- Contact SAS Technical Support by entering a support request
Contributing
We welcome your contributions! Please read CONTRIBUTING.md for details on how to submit contributions to this project. Some libraries have different contribution terms that are specific to that library. These cases are noted in the library README and CONTRIBUTING files located in the corresponding package folder at /sdk
.
License
This project, which includes all files in this GitHub repository, is licensed under the Apache 2.0 License. Some libraries in this SDK have published packages that are individually licensed under terms that are specific to that library. These cases are noted in the library README and LICENSE files located in the corresponding package folder at /sdk
.
Additional Resources
- SAS Visual Analytics SDK on developer.sas.com
- SAS Content SDK on developer.sas.com
- SAS Visual Analytics documentation
- SAS Visual Analytics Community
Getting object names
Hi there,
What is the best way to get all object names included in the report? I need it in order to get object handlers using
getObjectHandle
method.Thank you in advance.
Can't add the "Remove all role assignments" or a similar option (e.g. "Select/remove data role assignments" ) to the three-dotted menu of a report object
Hi there,
We use SAS VA SDK 1.10.0 to embed a VA report created on SAS Viya 2022.1.2.
We need to enable the end-user of the web app to select/remove data role assignments from different report objects: e.g. list table, crosstab, line chart, waterfall chart.
In SAS Visual Analytics on SAS Viya, a guest user can use the "Remove all role assignments" from the three-dotted menu of the respective objects:
After removing all role assignments, the end user can add to the report object the data items they wish:
For example, to a list table:
Or to a line chart:

However, we don't see this option available in the web app while using SAS Viya SDK.
Please, enable the "Remove all role assignmnets" option (or even better, a similar option, e.g. "Select/remove data role assignmnts) from the three-dotted menu of the respective objects in SAS Viya SDK.
Thank you very much in advance!
Uncaught (in promise) TypeError that appears in Firefox only
There is an
Uncaught (in promise) TypeError
thrown error that appears in Firefox only. It happens when a selection is made in DDC, but only in one DDC (there are other similar components that work totally fine). The page also reloads (which probably happens because of304
status for the first request). OS:macOS
Firefox:102.4.0
SAS VA SDK:1.13.0
An out of memory error in Firefox
Hi there,
SAS VA SDK throws an error and refuses to render a report on an older version of Firefox. At the same time, it works fine on the latest version of Firefox and Chrome. OS:
macOS
SAS VA SDK:1.13.0
Firefox:90.0
add documentation for restrictViewportGestures
This feature was added to improve the user experience while scrolling a page that contains report objects. It is easy to get stuck in a graph while scrolling. As you are scrolling the page the mouse enters a graph and starts zooming the graph instead of scrolling the page. With restrictViewportGestures turned on, the zooming does not happen by default. The user is required to press a modifier key to engage the zoom. On mac this is the cmd key, while on windows it will be the ctrl key.
fix content sdk viya setup doc
When fixing #33 I saw that the content SDK viya setup doc links were pointing to the internal dev versions of the doc, not the production doc server. Also, its viya setup doc had become out of sync with recent updates made to the VA SDK doc. This fixes the links and updates the doc wording to be in sync with the VA SDK doc.
add documentation for setFormatterLocale
This adds documentation for setFormatterLocale, which sets the locale used by va-sdk for numeric values and dates to be something different than the value set by setLocale and the broswer setting.
getSelectedData example code
Demonstrates use of getSelectedData and the selectionChanged event listener by displaying the selected data in a table & updating when selections change
Sending message with empty selection
Hi there,
Issue
I have an issue with sending an empty selection in SAS VA SDK
1.13.0
.Use case (simplified)
I have a DDC that is used to select gender
Man
andWoman
and a DDC that is used to display statistical data as a table. So changing gender selection and sending the selection usingwindow.parent.postMessage
works perfectly fine for both Man and Woman selected, only one gender selected, but it doesn't work if no gender is selected. If a message is posted with an empty selection, SAS responds with the previous selection and it makes sense because gender is required to get the data. But in my particular use case, if no gender is selected, the table should display summarized data for both genders.Is there a way to get summarized data if an empty selection is sent? Thank you in advance