cancel
Showing results for 
Search instead for 
Did you mean: 

Scheduled job reprints entire sheduled job history

Former Member
0 Kudos

Post Author: BrianHetman

CA Forum: .NET

I have a vb app that prints a report thru the scheduled job function. See code below. When I print a job it is added to the scheduled job history. The next time I print that report it prints along with all of the jobs that are in the history queue. How do I stop this from happening?VB SOURCE CODEDim serverName As String = Nothing Dim myInfoStore As InfoStore Dim sQuery As String Dim ceReportObjects As InfoObjects Dim ceReportObject As InfoObject Dim ceReport As Report Dim mySessionMgr As SessionMgr = New SessionMgr Dim ceParameters As ReportParameters Dim ceParameter As ReportParameter Dim ceParamValue As ReportParameterValue Dim x As Short Try serverName = "SRVUSE747N7F9" Dim myEnterpriseSession As EnterpriseSession = mySessionMgr.Logon( _ "administrator", "password", serverName, "secEnterprise") Dim myEnterpriseService As EnterpriseService = myEnterpriseSession.GetService("InfoStore") myInfoStore = New InfoStore(myEnterpriseService) sQuery = " SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND = 'CrystalReport' and SI_NAME = '" & whatReport & ".rpt'" ceReportObjects = myInfoStore.Query(sQuery) If ceReportObjects.Count > 0 Then ceReportObject = ceReportObjects.Item(1) ceReport = CType(ceReportObject, Report) ' PARAMETERS ceParameters = ceReport.ReportParameters For Each ceParameter In ceParameters x = 0 Do While x < cnt If ceParameter.ParameterName = varName(x) Then ceParamValue = ceParameter.CreateSingleValue() ceParamValue.SingleValue.Value = varValue(x) ceParameter.CurrentValues.Add(ceParamValue) End If x += 1 Loop Next ceReport = New Report(ceReportObject.PluginInterface) ''''Create an interface to the scheduling options for the report. Dim cetest As Printing.PrintDocument Dim ceSchedulingInfo As SchedulingInfo ceSchedulingInfo = ceReport.SchedulingInfo '''''run the report right now ceSchedulingInfo.RightNow = True ''''run the report once only ceSchedulingInfo.Type = CeScheduleType.ceScheduleTypeOnce ''''Set the ReportPrinterOptions for the report Dim cePrinterOptions As ReportPrinterOptions cePrinterOptions = ceReport.ReportPrinterOptions With cePrinterOptions .Copies = numberOfCopies .Enabled = True .FromPage = 1 .ToPage = 1 .PrinterName = whatPrinter '"LEX01"

' this setting is mandatory .PageLayout = CeReportLayout.ceReportFileSettings End With 'Schedule the report myInfoStore.Schedule(ceReportObjects) 'MsgBox("Report Scheduled Successfully with an Object ID of : " + ceReportObject.Properties("SI_NEW_JOB_ID").ToString) Else 'no objects returned by query 'MsgBox("No report objects found by query <br>") 'MsgBox("Please click <a href='Index.aspx'>here</a> to return to the logon page.<br>") End If Catch ex As Exception 'MsgBox(ex.Message) End Try

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Post Author: Ted Ueda

CA Forum: .NET

sQuery = " SELECT TOP 1 * FROM CI_INFOOBJECTS WHERE SI_KIND = 'CrystalReport' and SI_NAME = '" & whatReport & ".rpt' and SI_INSTANCE=0"

Sincerely,

Ted Ueda

Answers (0)