Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products



Calling an Integra Profile from a Notes Database Action Button

Notes Client - Notes Forms
A developer may want to further automate the process through which an end-user runs a particular Integra profile and rather than requiring the end-user to select the documents and then click on the Integra SmartIcon, a standard Lotus Notes action button could be made available on a particular Notes view or form which executes a pre-named Integra profile. This will allow the user to select the Action Button and Integra will execute the profile without providing a list of available profiles to be executed to the user. This procedure allows a greater level of integration between a specific Notes application and the Integra environment. Please note that while this option can be utilized, it is not necessary to make such changes to your applications but rather it is optional.

To create an Action Button to run a profile for example called MyIntegraProfile, use the following code:


REM "Add the name of your chosen Integra profile into the next instruction" ;

@SetEnvironment("IntegraProfileName";"MyIntegraProfile");

olrid := @Environment("IntegraReplicaID");
srv := @Subset(@DbName;1);

@SetEnvironment("IntegraCurrentSrv";srv);
@SetEnvironment("IntegraCurrentDB";@Subset(@DbName;-1));
@SetEnvironment("IntegraUiView";@Subset(@ViewTitle;-1));
@SetEnvironment("IntegraUiDocID";@Text(@DocumentUniqueID));

@If(olrid="";
@Return(@Prompt([Ok];"Integra Runtime";"Integra not installed!"));
@PostedCommand([FileOpenDBRepID];olrid;srv;"Structure Profiles";"";1;0)
);

@PostedCommand([OpenFrameset];"Preselected Profiles");
@PostedCommand([OpenView];"Structure Profiles";"";0);
@PostedCommand([FileCloseWindow]);
@PostedCommand([FileCloseWindow])


Notes Client - XPages
To be able to run an Integra profile from within an Xpage loaded inside the Notes client the following server-side code must be triggered.
The Developer can place the code in the "OnClick" event of an Xpages button (or any similar Xpages control which allows the usage of server-side script.) and change the first line to the name of the Integra profile to be run. Should the developer want the user to choose the profile to run, the value of the variable i4nProfileName at line 1 should be set to a blank string (var i4nProfileName = "";)
N.B. The code provided below does not work in a web browser


/*Assign the name of the Integra profile you wish
to run to the variable below. Leave blank to allow
the user to select the profile from a list*/

var i4nProfileName = "My Integra Profile";

/************************************************************
*************************************************************
DO NOT MODIFY THE CODE BELOW
*************************************************************
*************************************************************/

var olrid = session.getEnvironmentString("IntegraReplicaID");
var pth = session.getCurrentDatabase().getFilePath();
var srv = "";
var i4nFrameSet;

olrid = olrid.replace(":","");


if (session.isOnServer()){
srv = session.getCurrentDatabase().getServer();
}

session.setEnvironmentVar("IntegraCurrentSrv",srv);
session.setEnvironmentVar("IntegraCurrentDB",pth);
session.setEnvironmentVar("IntegraUiView","");
session.setEnvironmentVar("IntegraUiDocID","");
session.setEnvironmentVar("IntegraProfileName",i4nProfileName);


if (i4nProfileName == ""){
i4nFrameSet = "Integra Runtime";
}else{
i4nFrameSet = "Preselected Profiles";
}


if (olrid == "") {
return alert("Integra not installed!");
}
else {
var url = "notes://"+srv+"/"+olrid+"/"+i4nFrameSet+"?OpenFrameset";

facesContext.getExternalContext().redirect(url);
}

/************************************************************
*************************************************************
DO NOT MODIFY THE CODE ABOVE
*************************************************************
*************************************************************/


Web Browsers
If the notes database is to be used from the web then the code within the Action Button needs to be different.

You will need to paste the JavaScript below into the action button. The Variable "ProfileName" needs to be set to the name of your profile.

// Pre-define profile name or leave blank to prompt user with profile list
var ProfileName = "";
// Set to 1 if Integra shall run on the current document
// Set to 0 if Integra shall run on selected documents in view or
// on all documents in view (depending on profile settings)
var UseCurrentDoc = 0;
//Error message displayed when cookies are disabled
//You can modify this to display different messages depending on the language
//selected by the user
var errmsg = "Integra for Notes cannot run because cookies are disabled!";
//=============================================
// Do not change the code below !!!!!!
if (window.navigator.cookieEnabled == false)
{
alert(errmsg);
}
else
{
var url = window.location;
var path = url.pathname.toLowerCase();
var dbpos = path.indexOf(".nsf");
var dtExpires = new Date((new Date()).getTime() + 1000 * 60);
var cCooking;
cCooking = "IntegraProfileName=" + escape(ProfileName); // The name=value
cCooking += "; expires=" + dtExpires.toGMTString();
window.document.cookie = cCooking;
cCooking = "IntegraCurrentDoc=" + UseCurrentDoc; // The name=value
cCooking += "; expires=" + dtExpires.toGMTString();
window.document.cookie = cCooking;
path = path.substring(0,dbpos+5)+"Integra4WebSelectedDocuments?Openform";
var wwidth = 550;
var wheight = 325;
var scr = window.screen;
var top = (scr.width-wwidth)/2;
var left = (scr.height-wheight)/2;
window.open(path, "", "width=" + wwidth + ",height=" + wheight +
",left=" + left + ",top=" + top +
",toolbar=0,location=0,status=0,scrollbars=0,resizable=0,menubar=0,directories=0");
}


Please refer to FAQ 0234 if you would like to trigger an Integra report from the onUnload event or the WebQuerySave event of a Notes document.

.




FAQ# 0225
Bookmark and Share

 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024