BookmarkSubscribeRSS Feed
RichardP
Quartz | Level 8

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

 

12 REPLIES 12
Pmyosh
Obsidian | Level 7

Hi Richard,

 

Kindly give more clarity on your question. Are you referring to "data" that was promoted?

RichardP
Quartz | Level 8

Hi,

 

no I am referring to a report object.

 

regards, 

 

Richard

 

bheinsius
Lapis Lazuli | Level 10
Hi Richard,

Did you find an answer to your question?
Or another way to import to a different folder than the source?

Regards,
Bart
RichardP
Quartz | Level 8
Hi Bart,

hope your are well. No sorry, I was not able to find a solution for this. To be honest I haven't looked into this in a while, perhaps the new version of Viya provides more possibilities.

groet,

Richard

bheinsius
Lapis Lazuli | Level 10

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?

 

KianSin
Obsidian | Level 7
Hi Bart,
As of VA 8.5, this is still the same behaviour.
BrunoMueller
SAS Super FREQ

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:

POST https://yourserver/reports/reports?parentFolderUri=/folders/folders/75d5f145-80ae-4271-9628-ac2f620f...

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:

  • create a folder if it does not exist
  • script does not cater to put report into a new folder, this would need to be added

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. 

XavierBizoux
SAS Super FREQ

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

Xavier BIZOUX
Advisory Technical Architect ● Global Enablement and Learning
Technology Transfer and Governance, R&D
KianSin
Obsidian | Level 7
Hi Xavier,
Thank you. Will take a look when I work on SAS Viya in the future.
Cheers.
rgreen33
Pyrite | Level 9

@XavierBizoux ,

 

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.

 

  • First, the links in the post appear to no longer be valid.  Can you provide current URLs for these scripts?  I can find the scripts at the following URL (https://github.com/xavierBizoux/viyaRestPy/), but I am not sure if the ones that should be used.

  • I am not familiar with Python scripts.  Any tips on running these scripts?  Do these run locally on my machine...pulling and pushing data to Viya?  Any help that could be provided is greatly appreciated.  Any resources that you can might be able to point me to is also greatly appreciated.

  • Some of my reports have images embedded.  Do these scripts allow for those images to be remapped to different locations on the destination server?

  • You mentioned in your post the following:  "This option is better if the report exists and you don't want to break the links to this report."  Does this mean that if we have weblink that are pointing directly to reports (using the "Copy link" option in Viya, which embeds the URI into the URL) will remain the same and continue to work after promoting and existing report from dev to prod?  Obviously, this is a concern with what I am currently seeing in Viya.

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 

XavierBizoux
SAS Super FREQ

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

 
 
Xavier BIZOUX
Advisory Technical Architect ● Global Enablement and Learning
Technology Transfer and Governance, R&D
rgreen33
Pyrite | Level 9

@XavierBizoux

 

Super!  Thank you for the updated info!  I will take a look.

 

Thanks again!