How to add files to comments in SAC
SAP Analytics Cloud (SAC) offers a commenting function that allows users to easily post their opinion on values or explain a status. They can e.g. right-click on a value and choose "Add Data Point Comment" ...
...enter a comment and choose "Place Comment":
These comments are then visible for others, who can also “like” the explanations.
How to post files in SAC comments?
Unfortunately SAP Analytics Cloud only supports pure text comments. So what if you want to share files with your colleagues that shall prove your point or provide further explainations?
biexcellence’s biSharing Custom Widget allows you to upload files and post the link into your comments. It supports both classic on-premise Sharepoint installations as well as Office365 OneDrive configurations.
Let's have a look at a simple demo application:
This simple demo application contains:
- Table Component to display the data
- Text Area Component to enter a comment, which will be posted with the document link that is provided by the biSharing Widget
- Button to request the document link from the biSharing Widget
- biSharing Widget, which is not visible to the end user but provides the script methods to make it happen
The workflow for posting a comment with link in theis demo application is that the user:
- selects the cell of the Table Component, which shall be commented
- enters the comment in the Text Area, e.g. “This is my comment”
- clicks on the Button “Post & add link”.
- Having selected the file to share (see below how this is done in detail) the user finally sees the comment and link posted to the cell:
Using the biSharing Widget
Only two events are needed to realize this scenario:
onClick
of Button “Post & add link”:onSuccess
of biSharing Widget:
The following main methods are provided to produce the document link (they will described in detail further below):
uploadToShare
selectToShare
The following events are provided:
onSend
: Triggered whenuploadToShare
orselectToShare
is called. You can use it e.g. to callApplication.showBusyIndicator()
onSuccess
: Triggered when the service link is ready. As in the example above, you can access the link by callinggetServiceMessage()
. Of course you can also hide the busy indicator here.onError
: This event is triggered if the document link could not be determined. A call ofgetServiceMessage()
will provide you with the reason or error message.
The following properties are provided:
- Sharing – Channel: Defines the tool which shall be used for sharing and providing the document link, respectively. Currently only Microsoft Sharepoint and OneDrive are available. The solution can easily be enhanced to support SAP systems, Web Services, etc.
- Server Url: Specifies biexcellence’s cloud service, which hosts the sharing services
- License Key: For evaluation purposes, please enter your user that you registered on www.biexcellence.com
Upload a file to Sharepoint and share its link in a comment
The central method for this scenario is uploadToShare
. When it is called, the biSharing Widget shows a file selector within the dashboard, uploads the file to Sharepoint and returns the link for the uploaded file.
- The display of an upload popup is triggered via
uploadToShare
: - The user can click on “+” to select a file from the computer. The file is instantly uploaded to SharePoint.
- Once the process is finished, the
onSuccess
event is triggered.
To make this work, access to the Sharepoint instance has to be configured. This is done with the addConnectionParameter
method:
biSharing_1.addConnectionParameter("site", "mysharepointurl");
biSharing_1.addConnectionParameter("library", "mylibrary");
biSharing_1.addConnectionParameter("user", "myuser");
biSharing_1.addConnectionParameter("pwd", "mypwd");
In the next version, these parameters can also be centrally defined for your organization on our Cloud Service.
Select a file from Onedrive and share its link in a comment
The central method for this scenario is selectToShare
. When it is called, the Widget opens the onedrive login, afterwards shows the folder structure of OneDrive and allows to select a file to share via a comment.
- A popup window is triggered via
selectToShare
, where the user is asked to enter the credentials: - The user is forwarded to the file selector.
- An existing file can be selected. Alternatively, a new one can be uploaded and s elected.
- “Open” must be clicked to return the link of the selected file and to trigger the
onSuccess
event.
To make this scenario work, you have to provide the clientId
of your onedrive account:
biSharing_1.addConnectionParameter("clientId", "myclientid");
The following link decribes how to set up the clientid
for your Office365 account:https://docs.microsoft.com/en-us/onedrive/developer/controls/file-pickers/js-v72/?view=odsp-graph-online#setting-up