Hello,
According to the E-learning training I just completed it would appear that exporting a report and then importing it back into a different folder is not possble. I quote "You cannot specify a new location for imported objects, they go to the location encapsulated within the package". Has anyone tries manipulating the export file to achieve this? Any other solutions, ideas? All input welcome!
regards,
Richard
Hi Richard,
Kindly give more clarity on your question. Are you referring to "data" that was promoted?
Hi,
no I am referring to a report object.
regards,
Richard
Bedankt Richard.
Does anyone else know if this is possible, so import a report directly into a specific folder instead of having the original folder structure recreated?
You could build your own tool for this, using the REST API provided. The basic structure would be:
1. Get the report content from the source system:
GET https://yourserver/reports/reports/14990fe5-6a32-409c-bdd2-3da6c89479f2/content
Doc: https://developer.sas.com/apis/rest/Visualization/#get-report-content
2. Next create a new Report in a new folder on the target system:
Doc: https://developer.sas.com/apis/rest/Visualization/#create-report
3. Update the newly created report:
PUT https://yourserver/reports/reports/3a200423-7a9d-4785-8a02-02b20b513373/content
Doc: https://developer.sas.com/apis/rest/Visualization/#update-a-report
The calls above contain URI's like "/reports/reports/3a200423-7a9d-4785-8a02-02b20b513373"
My colleague @XavierBizoux created some python scripts to work as outlined above. The scripts are currently missing:
But it is a starting point. You will find the scripts here: https://github.com/xavierBizoux/SAS/tree/master/CICD/Reports
Also have a look at https://github.com/sassoftware/pyviyatools for additional examples on how to do REST calls from Python
Find attached a SAS program I used for verification of the three steps. You will need to adapt the URI's for you environment.
Hi,
As Bruno mentioned I created a wrapper for REST API's, as the functionality to create the folder automatically was missing, I've decided to add it. So, it's now available.
You should be able to use the getReport.py to extract the report. https://github.com/xavierBizoux/viyaRestPy/blob/master/Examples/DevOps/getReport.py
When the report is extracted to a json file, you can update the folder location in the json file and then upload the report using the createReport.py script https://github.com/xavierBizoux/viyaRestPy/blob/master/Examples/DevOps/createReport.py
If the report already exists in the target environment, you should another function updateReport. This option is better if the report exists and you don't want to break the links to this report.
Using these scripts, you should be able to copy a report from one environment to another (or to the same environment) in a different location. If you want to change the table used in the report, you can also modify the json file that is created by the getReport.py. You can therefore use python code to update the json content.
If you need help, please let me know.
Regards,
Xavier
PS: if you want to contribute to the project, please don't hesitate. The only restriction is to use the callRest function when calling the REST API's
I know that this post is a few months old, but this is the best news that I have seen today! Unfortunately, I am new to Viya (we are currently in the process of moving from SAS 9.4M5 to Viya - currently in the process of migrating/fixing our reports and configuring the Viya environment). In Viya, we have a dev environment and a prod environment, so your post will welcomed news, as I have been struggling with the promotion process. Being new to the Viya environment, I do have some questions that I hope that you can expand upon.
I appreciate any help that you can provide on this. During our migration, I was greatly surprised that a better solution was not included in Viya. I was hoping that I had missed something on my research. However, it seems that others have the same questions that I have. I look very forward to hearing from you.
Thank you,
Ricky
Hi
I've updated the package and the file named changed. I don't appear to be able to update the links in the previous post.
The link to extract the report is and report content is https://github.com/xavierBizoux/viyaRestPy/blob/master/Examples/DevOps/get_report.py
And the one to create a report is https://github.com/xavierBizoux/viyaRestPy/blob/master/Examples/DevOps/create_report.py
In terms of running the scripts, you should have a better understanding after reading the following blog: https://communities.sas.com/t5/SAS-Communities-Library/Enrich-SAS-VA-Geo-Maps-with-pinned-locations-...
It should be possible to update the image references using python code. The logic will be close to the one described in the blog.
For the update report option, this is indeed the best approach if links to a report was sent or used in other locations like the VA SDK. Nevertheless, the URI might be different in Dev and Prod environments depending on how the report was imported.
If you have questions about promotion and CI/CD topics, feel free to contact me or a local consultant who should be able to help you with the details and choosing the best approach.
Regards,
Xavier
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!