Tuesday, July 24, 2012

Setting up iBot to save report to a folder


Here are the steps;


Create a JavaScript file with below contents name it "savetofile.js" and save it at \\bise1\bi\server\Scripts\Common ;

var FSO = new ActiveXObject("Scripting.FileSystemObject");
//var foldername = GetConfigurationValue("Log Dir", "iBots") + "\\" + UserID
var foldername = "\\Reports"
var rptname;
with (new Date) {
rptname = ((((getFullYear() * 100 + getMonth() + 1) * 100 + getDate()) * 100 + getHours()) * 100 + getMinutes()) * 100 + getSeconds();
}
if (FSO.FolderExists(foldername))
{
var fileName = foldername + "\\" + "RPT_" + rptname + Parameter(1) + Parameter(2);
var fooFile = FSO.CopyFile(Parameter(0), fileName, true);
}
else
{
FSO.CreateFolder(foldername);
//var fileName = foldername + "\\" + JobID + "-" + InstanceID + "-" + Parameter(1);
var fileName = foldername + "\\" + "RPT_" + rptname + Parameter(1) + Parameter(2);
var fooFile = FSO.CopyFile(Parameter(0), fileName, true);
}



Step 1: Create an iBot and set schedule as required;



Step 2: Select Delivery Contents for iBot and select send content as “Attachement(PDF)”



Step 3: Select Email for the Specific Devices in the destination Tab;



Step 4: In the advanced tab select Add Action and then Custom Script



Step 5:
In the file name add “savetofile.js”
Select “Pass Delivery content to script” in the radio button
In the other parameter add two text boxes. In the first box add file name and in the second box add file extension and click OK



Step 6: Save the iBot



Step 7: The report will be saved in the directory “C:\Reports”
File will be named with following convention;
RPT_DATETIME_REPORTNAME.EXTENSION



Step 8: Done and the iBot will look like this;


Thanks,
 
Satya Ranki Reddy

3 comments:

  1. How can we implement the same in obiee 11g.

    ReplyDelete
  2. Hi Chandu,

    Please refer the below my New post.

    http://satyaobieesolutions.blogspot.in/2013/03/oracle-bi-ee-11g-calling-vb-scripts-to.html

    http://satyaobieesolutions.blogspot.in/2013/03/oracle-bi-ee-11g-calling-js-scripts-how.html

    Thanks,
    Satya

    ReplyDelete