BookmarkSubscribeRSS Feed
Shubham5497
Fluorite | Level 6

Hi

Here what we are trying to do. 

we have given multiple filter option on Viya report, filter value we are passing using DDC object to SAS Viya job execution with the help of java script and HTML code. After all the calculation I'm streaming the output of the job back to the Viya in DDC object as ODS output. Now we are trying to give the download option so that user can download the job output in  form of PDF or csv. we tried to give the download link option on job output  but  that link is not working in Viya Report. If we open same link from sas viya job execution web application(by clicking on retrieve job output) then that link working.

is it possible to give the download in Viya for ODS output? if yes how can we do that?

 

here is sample code for download link.

filename f_xlxp filesrvc parenturi="&SYS_JES_JOB_URI" 
  name='Class.xml' 
  contenttype='application/vnd.ms-excel'
  contentdisp='attachment; filename="report.xlsx"';

filename f_csv filesrvc parenturi="&SYS_JES_JOB_URI" 
  name='Class.xml' 
  contenttype='application/vnd.ms-excel'
  contentdisp='attachment; filename="report.csv"';

filename f_pdf filesrvc parenturi="&SYS_JES_JOB_URI" 
  name='Class.pdf' 
  contenttype='application/pdf'
contentdisp='attachment; filename="report.pdf"';

filename f_rtf filesrvc parenturi="&SYS_JES_JOB_URI"
 name='Class.rtf'
 contenttype='application/rtf'
 contentdisp='attachment; filename="report.rtf"';


ods pdf file=f_pdf style=&_ODSSTYLE;
ods rtf file=f_rtf style=&_ODSSTYLE;
ods CSVALL file=f_csv style=&_ODSSTYLE;

ods tagsets.ExcelXP file=f_xlxp style=&_ODSSTYLE
  options(embedded_titles='yes'
          suppress_bylines='yes'
          sheet_name='Report'
          print_header='&C&A');

	Title bcolor=antiquewhite bold "&report For the Year &year";
  proc sql ;
	
	select &select_value
	from &TableName
	&where_cond &tbl_chnl_col &tbl_zon_col &tbl_lob_col &tbl_brnch_col &tbl_prod_col
	group by &GroupBy_value
	;
	
	quit;
	
	
ods pdf close;
ods rtf close;
ods csvall close;

ods tagsets.ExcelXP close;
	
	

%let EXCEL_LINK=%bquote(<a href=""&_FILESRVC_F_XLXP_URI/content"" target='_SELF'>Excel</a>);
%put &=EXCEL_LINK;

%let PDF_LINK=%bquote(<a href=""&_FILESRVC_F_PDF_URI/content"" target="_TOP">PDF</a>);
%put &=PDF_LINK;
%let RTF_LINK=%bquote(<a href=""&_FILESRVC_f_rtf_URI/content"" target="_webout">RTF</a>);
%put &=RTF_LINK;
%let CSV_LINK=%bquote(<a href=""&_FILESRVC_f_csv_URI/content"" target=""_SASDLResults"">CSV</a>);
%put &=RTF_LINK;

filename f_htm filesrvc parenturi="&SYS_JES_JOB_URI"
  name='_webout.htm';	
  ods html5 file=f_htm  style=&_ODSSTYLE  text="<span>^{style systemtitle Download link^{nbspace 3}&EXCEL_LINK^{nbspace 3}&PDF_LINK ^{nbspace 3}&RTF_LINK^{nbspace 3}&CSV_LINK}</span>";



	
	Title bcolor=antiquewhite bold "&report For the Year &year";
  proc sql;
	
	select &select_value
	from &TableName
	&where_cond &tbl_chnl_col &tbl_zon_col &tbl_lob_col &tbl_brnch_col &tbl_prod_col
	group by &GroupBy_value
	;
	
	quit;
	
	
	
	ods html5 close;

Attaching the screenshot of Viya Report

DDCobject.PNG

 

Thanks.