Your SAS programs, embedded in web apps and elsewhere

Issue with streaming html/Excel

Reply
Occasional Contributor
Posts: 9

Issue with streaming html/Excel

Hi,

I've a Stored process web app which will ultimately run in the Info. Delivery Portal. It displays some streaming HTML into the browser then sends (diverts?) the streaming output to Excel (using the HTTP header functions.) The initial stored process does some data manipulation/selection and then displays a button (FORM/INPUT) which, when clicked, calls a second stored process to write the Excel stream.

When the Excel file is written I am left with an orphaned browser (the output from the first stored process) which I'd like to close automagically. (I tried using the onclick event and the window.close javascript functions and they closed the browser WITHOUT running the second stored process to create the Excel output.) Any suggestions or direction would be much appreciated.

Thanks.
Super Contributor
Posts: 321

Re: Issue with streaming html/Excel

Hi

Where did you place the javascript of window.close? If it's on your first stored process then you won't be able to get to the second one.

Try to stream an html with a window.close onload after writing to excel on your second stored process.

Hope this helps.

Milton
Occasional Contributor
Posts: 9

Re: Issue with streaming html/Excel

Hi,

Thanks for the reply. Yeah, I tried the window.close in the calling stored process and it did what you thought. (ie. closed the window before the stored process was called!) I am now trying as follows:

(2nd stored process)


data _null_;

rc = stpsrv_header('Content-type','application/vnd.ms-excel');

rc = stpsrv_header('Content-disposition','attachment;

filename=Temporary_Excel.xls');

run;



ods tagsets.excelxp body=_webout style=minimal;



proc print etc;

run;



ods tagsets.excelxp close;




ods html body = _webout text="<a id=""Test"" onclick=""window.close();"">End</a>";




data _null_;

put ;

run;



ods html close;



When I call this stored process in debug mode I get the excel output in HTML and see the link ok which works as expected. HOWEVER, in normal execution I get the streaming output into Excel but no browser is displayed at all.

Any additional suggestions gratefully received ....

Thanks.

Message was edited by: webminer
Ask a Question
Discussion stats
  • 2 replies
  • 254 views
  • 0 likes
  • 2 in conversation