BusinessObjects Board

Scheduling a Webi report from commandline.

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.

Thanks
Ram


ramaguru (BOB member since 2007-06-29)

Do you mean during the installation of Business Objects? Or during “installation” of the WebI report? How are you installing the WebI report now?


murphilly (BOB member since 2005-02-23)

I mean the total installtion…

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.


ramaguru (BOB member since 2007-06-29)

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.


murphilly (BOB member since 2005-02-23)

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: " &amp; 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: " &amp; 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 =" &amp; 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 '" &amp; myInfoObject.Title &amp; "' successfully Scheduled"
    Else
        DebugPrint "<BR>Error Scheduling Report: " &amp; Err.Description
    End If
    Set query  = Nothing
    Set myInfoObjects  = Nothing
    Set myInfoObject  = Nothing
    Set mySchedulingInfo  = Nothing
End Sub

murphilly (BOB member since 2005-02-23)