Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a report from command line

Status
Not open for further replies.

lantzba

Programmer
Jul 23, 2002
7
0
0
US
My company uses a centralized "robot" to schedule and execute processes. So instead of using Enterprise 8.5's scheduler, we want to have the robot execute the daily reports we generate. I am thinking that I can design a CSP page to kickoff the report, but how would I get that CSP page to kickoff from a command line prompt? Any ideas would be greatly appreciated. Thanks.
 
HEre's some sample code - it's pretty straightforward. I'm grabbing the name of the report as the first argument.

<job id='CommandLineScheduling'>
<script language='VBScript'>

Option Explicit

Const USERNAME = &quot;username&quot;
Const PASSWORD = &quot;password&quot;
Const APS = &quot;MyAPS&quot;

Dim sQuery
Dim sReportName

Dim ceSessionManager
Dim ceSession
Dim ceInfoStore
Dim ceInfoObjects
Dim ceInfoObject
Dim ceSchedulingInfo

sReportName = WScript.Arguments.Item(0)

Wscript.Echo &quot;Scheduling: &quot; & sReportName
Wscript.Echo

Set ceSessionManager = CreateObject(&quot;CrystalEnterprise.SessionMgr&quot;)

Set ceSession = ceSessionManager.Logon(USERNAME, PASSWORD, APS, &quot;secEnterprise&quot;)

Set ceInfoStore = ceSession.Service(&quot;&quot;, &quot;InfoStore&quot;)

sQuery = &quot;SELECT SI_ID FROM CI_INFOOBJECTS WHERE SI_PROGID='CrystalEnterprise.Report' AND SI_INSTANCE=0 AND SI_NAME = '&quot; & sReportName & &quot;'&quot;

Set ceInfoObjects = ceInfoStore.Query(sQuery)

If( ceInfoObjects.Count > 0 ) Then

Set ceInfoObject = ceInfoObjects.Item(1)

Set ceSchedulingInfo = ceInfoObject.SchedulingInfo

ceSchedulingInfo.Type = 0

ceInfoStore.Schedule ceInfoObjects

End If


' Dereference everything
Set ceSchedulingInfo = Nothing
Set ceInfoObject = Nothing
Set ceInfoObjects = Nothing
Set ceInfoStore = Nothing
Set ceSession = Nothing
Set ceSessionManager = Nothing

</script>
</job>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top