Skip to content

Commit 7ec64fc

Browse files
authored
Merge branch 'sassoftware:main' into main
2 parents 2b2a59a + 70990a0 commit 7ec64fc

File tree

7 files changed

+124
-0
lines changed

7 files changed

+124
-0
lines changed

CUSTOM_STEPS_LIST.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ The list of available Custom Steps further down on this page uses the following
126126
| [SID - Import Lookup Table](./SID%20-%20Import%20Lookup%20Table/README.md) | Import and activate a lookup table for SAS Intelligent Decisioning (SID) from input data | [Charlie Vismara](https://github.com/sbxchv) | 2024.12 <br>or later | 07FEB2025|
127127
| [Surrogate Key Generator](./Surrogate%20Key%20Generator/README.md) | Generates a surrogate key based on a business key | [Torben Juul Johansson](https://github.com/torbenjuul) | 2020.1.5 <br>or later | 29SEP2022 |
128128
| [Update column labels](./Update%20column%20labels/README.md) | Update column labels from a (metadata) table, delimited file, or interactively | [Ignacio Rodríguez](https://github.com/nachorodriguez79) | 2023.11 <br>or later | 21DEC2023 |
129+
| [VA - Export Report](./VA%20-%20Export%20Report/README.md) | Exports a package for the report in a compressed (zip) format. The returned content contains the report source files, plus the results of data queries and image rendering, constituting all that is needed for remote viewing of the report | [Remco Gooijer](https://github.com/x7rtfgj4) | 2025.08 <br>or later | 04NOV025 |
129130
| [VA - Extract Report Metadata](./VA%20-%20Extract%20Report%20Metadata/README.md) | Extract info about CAS tables and columns used, calculated column definitions and their usage, across objects in VA report | [Remco Gooijer](https://github.com/x7rtfgj4) | 2023.05 <br>or later | 27AUG2025 |
130131
| [VA - Get Column Explanation](./VA%20-%20Get%20Column%20Explanation/README.md) | Get an explanation for a column in a CAS table using the /insights/explain endpoint that is provided by SAS Visual Analytics. | [David Weik](https://github.com/Criptic) | 2025.08<br>or later | 25SEP2025 |
131132
| [VA - Get Report Content](./VA%20-%20Get%20Report%20Content/README.md) | Retrieve VA report definition and store it in a JSON file | [David Weik](https://github.com/Criptic) | 2025.05<br>or later | 23AUG2025 |

VA - Export Report/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# VA - Export Report
2+
3+
## Description
4+
Exports a package for the report in a compressed (zip) format. The returned content contains the report source files, plus the results of data queries and image rendering, constituting all that is needed for remote viewing of the report.
5+
6+
The step needs the location and name of the report and a physical location where the package will be stored.
7+
8+
The name of the package will always be the same as the report name with the optional addition of a date, format YYYYMMDD, or timestamp, format YYYYMMDD_HHMMSS.
9+
10+
## SAS Viya version support
11+
12+
This custom step is created and tested in Viya 4, Stable 2025.08
13+
14+
## User interface
15+
16+
### Tab: Options
17+
18+
![Options](img/VA-Export-Report-Options.png)
19+
- **Select the report for which you want to create an export package:**: Here you select the report for which you want to create the report package.
20+
- **Select the SAS compute file directory where the package will be created:** Here you need to select a physical directory where the report package will be stored.
21+
- **Add the following to the package name:** Here you have three choices:
22+
23+
| # | option | desciption | example result|
24+
|---|--------|------------|---------------|
25+
| 1 | &lt;Nothing>| This will add nothing to the resulting package name. Not that the default package name is the same as the name of the report. **This is the default value** | report_name.zip |
26+
| 2 | Date | This will add the current date in format YYYYMMD to the package name. | report_name_20251029.zip |
27+
| 3 | Timestamp | This will add the current date and time in format YYYYMMDD_HHMMSS to the package name. | report_name_20251029_150530.zip |
28+
29+
### Tab: About
30+
31+
![About](img/VA-Export-Report-About.png)
32+
33+
## Usage
34+
35+
Download the .step file, upload it into your environment and start using it by selecting a SAS Visual Analytics report, a physical location to store the package and run your flow or step.
36+
37+
## Custom step messages
38+
| Step message | Reason | Result |
39+
|--------------|--------|--------|
40+
| ERROR: Please select a location on the SAS Server. SAS Content folders are not supported by this custom step | The custom step only supports physical locations on the SAS compute environment | No package has been created.|
41+
| NOTE: Report package for "&reportName" successfully created.| A note in the log specifying that the report package has been created successfully.| A report package with name of the report, optionally, the date or datetime added to it saved in the specified physical location.
42+
| ERROR: Report package creation for "&reportName" failed. | The package creation failed. You will see the HTTP return code and the error description in the log file. | No package has been created.|
43+
44+
## Change log
45+
Version 1.1 (04NOV2025): Rename step and update wordings
46+
Version 1.0 (16OCT2025): Initial version.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"creationTimeStamp": "2025-11-04T07:40:19.20424Z",
3+
"createdBy": "gerdaw",
4+
"modifiedTimeStamp": "2025-11-04T07:55:27.040096Z",
5+
"modifiedBy": "gerdaw",
6+
"name": "VA - Export Report.step",
7+
"displayName": "VA - Export Report.step",
8+
"localDisplayName": "VA - Export Report.step",
9+
"links": [
10+
{
11+
"method": "GET",
12+
"rel": "self",
13+
"href": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
14+
"uri": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
15+
"type": "application/vnd.sas.data.flow.step"
16+
},
17+
{
18+
"method": "GET",
19+
"rel": "alternate",
20+
"href": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
21+
"uri": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
22+
"type": "application/vnd.sas.data.flow.step.summary"
23+
},
24+
{
25+
"method": "GET",
26+
"rel": "up",
27+
"href": "/dataFlows/steps",
28+
"uri": "/dataFlows/steps",
29+
"type": "application/vnd.sas.collection",
30+
"itemType": "application/vnd.sas.data.flow.step.summary"
31+
},
32+
{
33+
"method": "PUT",
34+
"rel": "update",
35+
"href": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
36+
"uri": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
37+
"type": "application/vnd.sas.data.flow.step",
38+
"responseType": "application/vnd.sas.data.flow.step"
39+
},
40+
{
41+
"method": "DELETE",
42+
"rel": "delete",
43+
"href": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
44+
"uri": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e"
45+
},
46+
{
47+
"method": "POST",
48+
"rel": "copy",
49+
"href": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e/copy",
50+
"uri": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e/copy",
51+
"responseType": "application/vnd.sas.data.flow.step"
52+
},
53+
{
54+
"method": "GET",
55+
"rel": "transferExport",
56+
"href": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
57+
"uri": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
58+
"responseType": "application/vnd.sas.transfer.object"
59+
},
60+
{
61+
"method": "PUT",
62+
"rel": "transferImportUpdate",
63+
"href": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
64+
"uri": "/dataFlows/steps/c141a8fb-0077-4c8c-8ada-d89e63995f1e",
65+
"type": "application/vnd.sas.transfer.object",
66+
"responseType": "application/vnd.sas.summary"
67+
}
68+
],
69+
"metadataVersion": 1,
70+
"version": 2,
71+
"type": "code",
72+
"flowMetadata": {},
73+
"ui": "{\n\t\"showPageContentOnly\": true,\n\t\"pages\": [\n\t\t{\n\t\t\t\"id\": \"page1\",\n\t\t\t\"type\": \"page\",\n\t\t\t\"label\": \"Options\",\n\t\t\t\"children\": [\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"_report\",\n\t\t\t\t\t\"type\": \"path\",\n\t\t\t\t\t\"label\": \"Select the report for which you want to create an export package:\",\n\t\t\t\t\t\"pathtype\": \"file\",\n\t\t\t\t\t\"placeholder\": \"\",\n\t\t\t\t\t\"required\": true,\n\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"_packageDir\",\n\t\t\t\t\t\"type\": \"path\",\n\t\t\t\t\t\"label\": \"Select the SAS Server directory where the package will be created:\",\n\t\t\t\t\t\"pathtype\": \"folder\",\n\t\t\t\t\t\"placeholder\": \"\",\n\t\t\t\t\t\"required\": true,\n\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"_addition\",\n\t\t\t\t\t\"type\": \"dropdown\",\n\t\t\t\t\t\"label\": \"Add the following to the package name:\",\n\t\t\t\t\t\"items\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"value\": \"<Nothing>\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"value\": \"Date\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"value\": \"Timestamp\"\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\t\"required\": true,\n\t\t\t\t\t\"placeholder\": \"\",\n\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"id\": \"page2\",\n\t\t\t\"type\": \"page\",\n\t\t\t\"label\": \"About\",\n\t\t\t\"children\": [\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"text1\",\n\t\t\t\t\t\"type\": \"text\",\n\t\t\t\t\t\"text\": \"VA - Export Report step\\n==================================\\nExports a package for the report in a compressed (zip) format. The returned content contains the report source files, plus the results of data queries and image rendering, constituting all that is needed for remote viewing of the report.\\n\\nThe step needs the location and name of the report and a physical location where the package will be stored.\\n\\nThe name of the package will always be the same as the report name with the optional addition of a date, format YYYYMMDD, or timestamp, format YYYYMMDD_HHMMSS.\",\n\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"section1\",\n\t\t\t\t\t\"type\": \"section\",\n\t\t\t\t\t\"label\": \"Changelog\",\n\t\t\t\t\t\"open\": true,\n\t\t\t\t\t\"visible\": \"\",\n\t\t\t\t\t\"children\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"id\": \"text2\",\n\t\t\t\t\t\t\t\"type\": \"text\",\n\t\t\t\t\t\t\t\"text\": \"* Version 1.1 (04NOV2025)\\n - Rename step and update wordings\\n* Version 1.0 (16OCT2025)\\n - Initial version\",\n\t\t\t\t\t\t\t\"visible\": \"\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t],\n\t\"syntaxversion\": \"1.3.0\",\n\t\"values\": {\n\t\t\"_report\": \"\",\n\t\t\"_packageDir\": \"\",\n\t\t\"_addition\": {\n\t\t\t\"value\": \"<Nothing>\"\n\t\t}\n\t},\n\t\"promptHierarchies\": []\n}",
74+
"templates": {
75+
"SAS": "/*\r\n The base URL for your SAS Viya installation.\r\n*/\r\n%let base_uri=%sysfunc(getoption(SERVICESBASEURL));\r\n\r\n/*\r\n The following timestamp can be used to configure the package name. \r\n*/\r\n%let timestamp = %sysfunc(compress(%sysfunc(time(), time8.), ':'));\r\n%let datestamp = %SYSFUNC(DATE(), YYMMDDN8.);\r\n%let dttmstamp = &datestamp._&timestamp;\r\n\r\n/*\r\n From the _report macro variable create a separate value for reportName and path.\r\n*/\r\ndata _null_;\r\n call symputx('reportName', kreverse(kscan(kreverse(kscan(\"&_report\", 2, ':')), 1, '/')));\r\n call symputx(\"path\", kreverse(ksubstr(kreverse(kscan(\"&_report\", 2, ':')), kfind(kreverse(kscan(\"&_report\", 2, ':')), '/'))));\r\n call symputx(\"packageDir\", kscan(\"&_packageDir\", 2, ':'));\r\n call symputx(\"dirType\", kstrip(kscan(\"&_packageDir\", 1, ':')));\r\nrun;\r\n\r\n/*\r\n This version will only work when the package is stored on a physical file system.\r\n*/\r\n%if &dirType eq sasserver %then %do;\r\n\r\n /*\r\n Based on the 'path' macro variable retrieve the endpoint to give me the folder members/content.\r\n */\r\n filename ref temp ;\r\n proc http\r\n url = \"&base_uri./folders/folders/@item\"\r\n query = (\"path\" = \"&path\")\r\n oauth_bearer = sas_services\r\n out= ref;\r\n headers\r\n 'Accept'= 'application/vnd.sas.content.folder+json';\r\n run;\r\n libname ref json;\r\n\r\n /*\r\n From the links table, store the member end-point and the content type into macro variables.\r\n */\r\n proc sql noprint;\r\n select \r\n href, \r\n type into :endpoint, :type\r\n from \r\n ref.links\r\n where \r\n method = \"GET\" and \r\n rel = \"members\";\r\n quit; \r\n\r\n /*\r\n Retrieve the members/content within the directory\r\n \r\n Note the limit addition, which needs to be large enough to contain the requested report.\r\n */\r\n filename members temp; \r\n proc http\r\n url = \"&base_uri.%trim(&endpoint)?limit=100\"\r\n oauth_bearer = sas_services\r\n out = members;\r\n headers\r\n \"Accept\"= \"%trim(&type)+json\";\r\n run; \r\n libname members json;\r\n\r\n /*\r\n Get the reportId for the specified report.\r\n */\r\n proc sql noprint;\r\n select\r\n kstrip(kreverse(kscan(kreverse(uri), 1, '/'))) as reportId length=64 into :reportId TRIMMED\r\n from\r\n members.items\r\n where\r\n name = \"&reportName\";\r\n quit;\r\n\r\n /*\r\n End user feedback.\r\n */\r\n %macro request_status;\r\n %if &SYS_PROCHTTP_STATUS_CODE eq 200 %then %do;\r\n %put NOTE: Report package for \"&reportName\" successfully created.;\r\n %end;\r\n %else %do;\r\n %put ERROR: Report package creation for \"&reportName\" failed.;\r\n %put &=SYS_PROCHTTP_STATUS_CODE;\r\n %put &=SYS_PROCHTTP_STATUS_PHRASE;\r\n %end;\r\n %mend;\r\n\r\n %macro create_package;\r\n /*\r\n Note, the resulting file will be a zip file.\r\n */\r\n %if &_addition eq Date %then %do;\r\n /*\r\n The export package has the date, YYYYMMMDD, added to it.\r\n */\r\n filename resp \"&packageDir/&reportName._&datestamp..zip\";\r\n %end;\r\n %else %do;\r\n %if &_addition eq Timestamp %then %do;\r\n /*\r\n The export package has the date/time, YYYYMMDD_HHMMSS, added to it.\r\n */\r\n filename resp \"&packageDir/&reportName._&dttmstamp..zip\";\r\n %end;\r\n %else %do;\r\n filename resp \"&packageDir/&reportName..zip\";\r\n %end;\r\n %end;\r\n\r\n /*\r\n Ask Viya to create the export package for the requested report.\r\n\r\n API documentation: https://developer.sas.com/rest-apis/visualAnalytics/getExportedReportPackage\r\n\r\n */\r\n proc http\r\n method='get'\r\n url = \"&base_uri./visualAnalytics/reports/&reportId./package\"\r\n oauth_bearer = sas_services\r\n out=resp;\r\n headers\r\n 'Accept'='application/zip, application/json, application/vnd.sas.error+json, aplication/json';\r\n run;\r\n\r\n /*\r\n Validate the return codes for the last HTTP call and give feedback to the end-user.\r\n */\r\n %request_status;\r\n %mend;\r\n %create_package;\r\n%end;\r\n%else %do;\r\n %put ERROR: Please select a location on the SAS Server. SAS Content folders are not supported by this custom step;\r\n%end;\r\n\r\n/*\r\n Remove all macro variables from memory.\r\n*/\r\n%symdel base_uri /NOWARN;\r\n%symdel timestamp /NOWARN;\r\n%symdel datestamp /NOWARN;\r\n%symdel dttmstamp /NOWARN;\r\n%symdel reportName /NOWARN;\r\n%symdel path /NOWARN;\r\n%symdel packageDir /NOWARN;\r\n%symdel reportId /NOWARN;\r\n%symdel dir_type /NOWARN;\r\n\r\n/*\r\n Remove all macros from memory.\r\n*/\r\n%SYSMACDELETE request_status / NOWARN;\r\n%SYSMACDELETE create_package / NOWARN;"
76+
}
77+
}
42.7 KB
Loading
27.4 KB
Loading
30 KB
Loading
12.8 KB
Loading

0 commit comments

Comments
 (0)