[Migrated content. Thread originally posted on 31 March 2003]
I find this vb demo to have a parameters i need some help to translate to cobol...So far i did that
77 hx-crreport handle of Report.
77 hx-crapp handle of Application.
77 hx-PARAMDEFS handle of ParameterFieldDefinitions.
77 hx-PARAMDEF handle of ParameterFieldDefinition.
77 hx-viewer handle of CRViewer9.
77 ws-fileid pic x(256)
value
"C:\\LCM\\CRYSTAL\\CLIENT.rpt".
create @Application of @CRAXDRT handle is hx-crapp.
modify hx-crapp @OpenReport (ws-fileid)
returning hx-crreport.
ACCEPT OMITTED.
MODIFY hx-crreport @DISPLAYPROGRESSDIALOG(1).
Here is the bugs i don't now what i have to put a modify or inquire
inquire hx-crreport @ParameterFields::hx-Paramdefs.
MODIFY hx-crreport @PrintOut(0).
destroy hx-crreport.
destroy hx-crapp.
Public Sub myreports()
Const RptFile = "\\Crystal\\MyReport.rpt"
dim crApp as new CRAXDRT.Application
Dim crRepp As CRAXDRT.Report
Dim crParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crParamDef As CRAXDRT.ParameterFieldDefinition
Dim crDBTab As CRAXDRT.DatabaseTable
' Open report file
Set crRepp = crApp.OpenReport(App.Path & RptFile)
' Set location of database based on WhatCompany
crRepp.Database.LogOnServer "p2ssql.dll", "Server Name", "DB Name", "User ID", "Password"
' Set table location to appropriate company server
For Each crDBTab In crRepp.Database.Tables
crDBTab.SetLogOnInfo "Server Name", "DB Name", "User ID", "Password"
Next
crRepp.DisplayProgressDialog = True
' Fill report parameters
Set crParamDefs = crRepp.ParameterFields
For Each crParamDef In crParamDefs
Select Case crParamDef.ParameterFieldName
Case "Parameter1"
crParamDef.SetCurrentValue ("Parameter 1 Value")
Case "@STARTDATE"
crParamDef.SetCurrentValue DateValue("01/01/1980")
Case "@ENDDATE"
crParamDef.SetCurrentValue DateValue("12/31/1980")
End Select
Next
DoEvents
crRepp.EnableParameterPrompting = False
' Display it for the user to print or export
crViewer1.ReportSource = crRepp
crViewer1.ViewReport
End Sub