Oracle BI EE 11g – Calling VB Scripts
How to save the reports scheduled via Agents to a local directory using a simple VB Script
Posted by Satya Ranki Reddy.
VB Script Method:
'#####=========================================================================
'## Title: Export Report
'## Rev: 1.0
'## Author: satya
'## Company: Total Business Intelligence / http://satyaobieesolutions.blogspot.com
'##
'## Purpose:
'## 1. This script takes a file from OBIEE and saves to the file system
'## 2. Creates a reporting subdirectory if not already present
'## 3. Creates a further subdirectory with name based on current date
'##
'## Inputs (specified in Actions tab of OBIEE Delivers Agent):
'## 1. Parameter(0) - This actual file to be exported
'## 2. Parameter(1) - The filename specified within OBIEE
'## 3. Parameter(2) - Report sub directory name specified within OBIEE
'##
'#####=========================================================================
'## Title: Export Report
'## Rev: 1.0
'## Author: satya
'## Company: Total Business Intelligence / http://satyaobieesolutions.blogspot.com
'##
'## Purpose:
'## 1. This script takes a file from OBIEE and saves to the file system
'## 2. Creates a reporting subdirectory if not already present
'## 3. Creates a further subdirectory with name based on current date
'##
'## Inputs (specified in Actions tab of OBIEE Delivers Agent):
'## 1. Parameter(0) - This actual file to be exported
'## 2. Parameter(1) - The filename specified within OBIEE
'## 3. Parameter(2) - Report sub directory name specified within OBIEE
'##
'#####=========================================================================
Dim sBasePath
sBasePath = "D:\satya\"
sBasePath = "D:\satya\"
Dim sMasterPath
sMasterPath = sBasePath & "\" & Parameter(2)
sMasterPath = sBasePath & "\" & Parameter(2)
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'check whether master directory exists, if not create
Dim objMasterDir
If Not objFSO.FolderExists(sMasterPath) Then
Set objMasterDir = objFSO.CreateFolder(sMasterPath)
End If
Set objMasterDir = Nothing
Dim objMasterDir
If Not objFSO.FolderExists(sMasterPath) Then
Set objMasterDir = objFSO.CreateFolder(sMasterPath)
End If
Set objMasterDir = Nothing
'build string to get date in yyyy-mm-dd format
Dim sDate, sDateFull
sDate = Now
sDateFull = DatePart("yyyy", sDate) & "-"
If Len(DatePart("m", sDate))=1 Then sDateFull = sDateFull & "0" End If
sDateFull = sDateFull & DatePart("m", sDate) & "-"
If Len(DatePart("d", sDate))=1 Then sDateFull = sDateFull & "0" End If
sDateFull = sDateFull & DatePart("d", sDate)
Dim sDate, sDateFull
sDate = Now
sDateFull = DatePart("yyyy", sDate) & "-"
If Len(DatePart("m", sDate))=1 Then sDateFull = sDateFull & "0" End If
sDateFull = sDateFull & DatePart("m", sDate) & "-"
If Len(DatePart("d", sDate))=1 Then sDateFull = sDateFull & "0" End If
sDateFull = sDateFull & DatePart("d", sDate)
Dim sDir
sDir = sMasterPath & "\" & sDateFull
sDir = sMasterPath & "\" & sDateFull
Dim objDir
If Not objFSO.FolderExists(sDir) Then
Set objDir = objFSO.CreateFolder(sDir)
End If
Set objDir = Nothing
If Not objFSO.FolderExists(sDir) Then
Set objDir = objFSO.CreateFolder(sDir)
End If
Set objDir = Nothing
Dim sFileName
sFileName = sDir & "\" & Parameter(1)
sFileName = sDir & "\" & Parameter(1)
Dim objFile
objFSO.CopyFile Parameter(0), sFileName, True
objFSO.CopyFile Parameter(0), sFileName, True
Set objFile = Nothing
Set objFSO = Nothing
Please copy the above script in notepad then save as satyaexport_report.vbs then move to this file as mention below path.
C:\OBIEE11G\instances\instance1\bifoundation\OracleBISchedulerComponent\coreapplication_obisch1\scripts\common
Follow the below steps:
Next Create ibot and execute it.
Hope this Help's
Thanks
Satya Ranki Reddy
No comments:
Post a Comment