Hi All
I am looking for a command line option to schedule a webi report, the idea is to automate the scheduling of one of the reports while installtion itself.
I would greatly appreciate any inputs on automating the report scheduling/command line utility usage for the same.
Lets assume BO is getting installed with my product. First BO is installed and then the universe and webi report templates.
I would like to schedule one of those report template at this point of time.
You can schedule a WebI report programmatically using the SDK. You could compile it into an EXE and call that from the command line. Or you could create a script file and call that from the command line.
Actually here is an example in VBScript, this is call report ID 348 which in my environment would the example “Charting” crystal report, but you can re-write the script to call a report by name if you like. This VBS can be called from the command line with the csript command. I like to wrap my scripts in batch files. You can even load the batch or the vbs into the CMS. If you load the batch make sure you have it run in the proper directory.
Call Main
Sub DebugPrint(message)
WScript.Echo message
End Sub
Function Main()
Dim IStore
Dim CMS, userID, password, aut
On Error Resume Next
userID = "Administrator"
CMS = "localhost"
password = ""
aut = "Enterprise"
Set IStore = Logon(CMS, userID, password, aut)
ScheduleReport IStore,"348", 1, True, True
If (Err.Number = 0) Then
DebugPrint "<BR>Completed Script "
Else
DebugPrint "<BR>Error in Main: " & Err.Description
End If
Set IStore = Nothing
End Function
Function Logon(CMS, userID, password, aut)
Dim sessionManager
Dim enterpriseSession
Dim iStore
Dim Users
On Error Resume Next
Set sessionManager = CreateObject("CrystalEnterprise.SessionMgr")
Set enterpriseSession = sessionManager.Logon(UserID, Password, CMS, Aut)
Set iStore = enterpriseSession.Service ("", "InfoStore")
If (Err.Number = 0) Then
DebugPrint "<BR>IStore Created"
Else
DebugPrint "<BR>Error Logging in: " & Err.Description
End If
Set Logon = iStore
Set sessionManager = Nothing
Set enterpriseSession = Nothing
Set iStore = Nothing
End Function
Sub ScheduleReport(myInfoStore, reportID, scheduleType, isRightNow, shouldExpire)
Dim query
Dim myInfoObjects
Dim myInfoObject
Dim mySchedulingInfo
On Error Resume Next
query = "Select SI_NAME, SI_ID From CI_INFOOBJECTS Where SI_ID =" & reportID
Set myInfoObjects = myInfoStore.Query(query)
Set myInfoObject = myInfoObjects(1)
Set mySchedulingInfo = myInfoObject.SchedulingInfo
mySchedulingInfo.RightNow = isRightNow
myInfoStore.Schedule myInfoObjects
If (Err.Number = 0) Then
DebugPrint "<BR>Report ID '" & myInfoObject.Title & "' successfully Scheduled"
Else
DebugPrint "<BR>Error Scheduling Report: " & Err.Description
End If
Set query = Nothing
Set myInfoObjects = Nothing
Set myInfoObject = Nothing
Set mySchedulingInfo = Nothing
End Sub