Hi,
When I launch the Stored Process Web Application (SPWA) and navigate the folder structure, the stored processes (STP) all have the "newwindow" action. For example:
http://myserver.com:8080/SASStoredProcess/do?_action=form,properties,execute,nobanner,newwindow&_program=%2FUsers%2Fsbass%2FMy+Folder%2FStored+Processes%2FExample+-+Batch+Program+Submission
1) I'd prefer this particular STP not launch a new window, but instead send its results to the right hand frame of the SPWA. In this regard, it is like the behaviour when no prompts are defined. How do I make this happen?
2) Furthermore, I'd prefer it display a javascript alert dialog "Your batch job has been submitted", and then redirect back to the originating STP (if a redirect is required).
I've got this code:
<html>
<head>
<script type="text/javascript">
alert("Your batch has been submitted. You will receive an email when your job has finished.");
window.location.href="http://<referring STP URL>"
</script>
</head>
<body>
</body>
</html>
It works fine in the browser, but I don't know how to get the referring URL in the STP. Do I need to edit Params.config to create _HTREFER? Or is there a better way to just display an alert without leaving the STP prompts window?
Thanks,
Scott
To answer the second question, you could use the history object.
Instead of setting the window.location.href property, call this method:
history.go(-1);
And the answer to your first question:
You can send the results to a specific browser frame by setting the _target macro in the SAS code:
&_target=name
In the Stored Process web app, the right frame is named "_stpOutput". To replace the prompts with the stored process output, set the _target macro like this:
&_target=_stpOutput
Thanks, a few more questions:
1) Does &_target=_stpOutput need to be a hidden prompt, or can I set it in the STP code, i.e. %let _target=_stpOutput early in the SAS code?
2) Is there a way to change the *generated* URL by the SPWA, on a per STP basis, to suppress &_action=whatever,newwindow?
3) So, combining all the above, would I:
* Create a hidden prompt &_target=_stpOutput? (depending on the answer to #1)
* And then write this to _webout via data _null_?
<html>
<head>
<script type="text/javascript">
alert("Your batch job has been submitted. You will receive an email when your job has finished.");
history.go(-1)
</script>
</head>
<body>
</body>
</html>
Thanks,
Scott
I've created a hidden prompt _target=_stpOutput. I'm still getting the newwindow popup, instead of the _webout content going to the right hand frame of the SPWA.
Hi,
I am not sure this will work or not..
data _null_;
file _webout;
if _n_ = 1 then do;
thissrv = symget('_url');
thispgm = symget('_program');
put '<FORM ACTION="' thissrv +(-1) '" method=get>';
put '<input type="hidden" name="_program" value="' thispgm +(-1) '">';
put '<input type="hidden" name=reqtype value="print">';
put '<tr>';
put ' <td align="right"><input type="submit" value="Submit Request" />
<input type="Reset" value="Reset" />
</td>';
put '</tr>';
put '</table>';
end;
run;
Thanks,
Shiva
Hello folks,
has there ever been a solution to this issue?
Regards,
Grischa
Regarding question 1, if you want all stored processes to be affected, then you can edit the "Welcome.jsp" file located in the .../sas_webapps/sas.storedprocess.war/input/Samples/Welcome/ directory. Look for this block of code:
<form id="IndexForm" action="<%=URI%>" method="post">
<input type="hidden" name="_action" value="index,form,properties,execute,newwindow" >
</form>
<form id="SearchForm" action="<%=URI%>" method="post">
<input type="hidden" name="_action" value="search,form,properties,execute,newwindow" >
</form>
<form id="ReportForm" action="<%=URI%>" method="post">
<input type="hidden" name="_action" value="index,form,properties,execute,newwindow" >
<input type="hidden" name="_type" value="report" >
</form>
The first instance of "newwindow" affects users that click on the "List Available Stored Processes and Reports" link on the Welcome page, and the second instance affects the "Search for Stored Processes and Reports" link.
Do not edit the "Welcome.jsp" file if you want to affect only some stored processes. You can bypass the Welcome page by accessing this URL:
http://yourserver.com:8080/SASStoredProcess/do?_action=index,form,properties,execute
Instead of starting here and then clicking "List Available Stored Processes and Reports":
http://yourserver.com:8080/SASStoredProcess/do
Vince DelGobbo
SAS R&D
Vince,
thanks a lot, this is a really helpfull tipp 😉
Regards,
Grischa
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.