Your SAS programs, embedded in web apps and elsewhere

Manipulating the default Execution options page

Reply
Contributor
Posts: 22

Manipulating the default Execution options page

A quick question, is there a way to automatically manipulate the execution options page so as to change the default setup from YES to NO, in order to displaying result in the same window rather than in a new window when running SAS Stored Processes? I appreciate it very much for the help!

Tan Yuanbin
Super Contributor
Posts: 259

Re: Manipulating the default Execution options page

Have a look at the support page: http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/stpwebapp.html
Unfortunately the "Open in new window" option is one of three that can not be suppressed.
SAS Employee
Posts: 285

Re: Manipulating the default Execution options page

You can change this behavior, but it involves replacing one of the JavaScript files that we ship. See the comments within the code to set the features you desire. In your case, you will need to set the value of the variable SAS_ResultsNewWindow to false. Note that this change will affect all stored processes.




DISCLAIMER: This code has not been fully tested; use it at your own risk.




Below are the steps. Step 2 is specific to the Tomcat Application Server, and you will need to adjust the path if you are using a different Java Application Server. The rest of the steps are the same, regardless of the application server.






  1. Stop your Java Application Server.


  2. Navigate to



    <Tomcat-install-directory>\webapps\SASStoredProcess\scripts\



  3. Rename the file

    dynamicPP_navigate.js

    to

    dynamicPP_navigate.js.ORI



  4. Create a new file named

    dynamicPP_navigate.js

    and open it using a text editor.


  5. Copy and paste the code below into the file

    dynamicPP_navigate.js

    and save the file. In the code below,

    Red

    indicates new code and

    blue

    indicates changed code, with the changes

    highlighted in yellow.



  6. Set the values of the variables

    SAS_HideExecutionOptions, SAS_HTTPMethod,

    and

    SAS_ResultsNewWindow

    to suit your needs.


  7. Restart your Java Application Server and execute a stored process to confirm the desired behavior.



For important information regarding execution options in SAS 9.2, see:



Usage Note 35063: Stored process execution options are no longer included in SAS® 9.2 by default




http://support.sas.com/kb/35/063.html





Vince DelGobbo


SAS R&D




[pre]

// Set SAS_HideExecutionOptions to true to hide the Execution Options, or false to show them

var SAS_HideExecutionOptions=false;

// Set SAS_HTTPMethod to GET to change the HTTP method from default value of POST to GET

var SAS_HTTPMethod="post";

// Set SAS_ResultsNewWindow to false to change force SAS output to be opened in the same window

var SAS_ResultsNewWindow=true;


// Highlight selected menu item and display the corresponding content
function showContent(menuItemName, menuAnchorName, contentElementName) {
/* Copyright(c) 2003-2004 by SAS Institute Inc., Cary, NC USA All rights reserved. */

var anchors, contentElement, contentWindow, i, size, menuElement;

// selectedLeftMenuItem, visibleContentElementName and menuAnchorElement are global

if (SAS_HideExecutionOptions == true) {

anchors = document.getElementsByTagName("a");
size = anchors.length;

for (i = 0; i < size; i++) {
href = anchors[i].href;
if (href.indexOf("AdvancedServerOptions") >= 0) {
anchors[i].style.display="none";
}
}

if (visibleContentElementName == "AdvancedServerOptions")
return;
}

// Set the HTTP method on the Execution Options panel if GET is requested

if (SAS_HTTPMethod.toLowerCase() == "get") {
document._advancedOptions.httpmethod[0].checked = true;
document._advancedOptions.httpmethod[1].checked = false;
}

// Set the "Display results in new window" option on the Execution Options panel to "No" if requested

if (SAS_ResultsNewWindow == false) {
document._advancedOptions.resNewWindow[0].checked = false;
document._advancedOptions.resNewWindow[1].checked = true;
}

menuAnchorElement = document.getElementById(menuAnchorName);

// Hide the currently visible element
contentElement = document.getElementById(visibleContentElementName);
contentElement.style.display = "none";

// Show the desired element
contentElement = document.getElementById(contentElementName);
contentElement.style.display = "";

menuElement = document.getElementById(menuItemName);

// Deselect previously selected menu item, if any
if (selectedLeftMenuItem != null)
selectedLeftMenuItem.className="portalTabVert";

// Select the clicked on menu item
menuElement.className="portalActiveTabVert";
selectedLeftMenuItem = menuElement;

visibleContentElementName = contentElementName;

window.setTimeout("menuAnchorElement.focus();", 200);

}
[/pre]
Contributor
Posts: 22

Re: Manipulating the default Execution options page

Cool! Tested, no problem so far. Thank you all very much!
Ask a Question
Discussion stats
  • 3 replies
  • 211 views
  • 0 likes
  • 3 in conversation