Showing posts with label coder. Show all posts
Showing posts with label coder. Show all posts

Tuesday, March 20, 2012

crystal reports (the coder way) ?

Hi

I have a .NET application that needs to obtain the details of the parameters for a crystal report.

I have written some code, that opens a report into the crystal viewer and the gets the parameter info and displays it in a msgbox.

However, the viewer prompts for the parameters, before i get a chance to get the information and display it.:(

My question is, does anyone know of a way that i can get the parameter information from a report, without the user being prompted for the parameters ?

Thanks in anticipation[Moved thread]|||YOu need to populate the parameters to the report before viewing it the viewer or printing it to the printer.

here is a sample from VB on how to populate parameters and formulas.

Dim crFormula As CRAXDRT.FormulaFieldDefinition
Dim crParam As CRAXDRT.ParameterFieldDefinition

crReport.DiscardSavedData

For Each crParam In crReport.ParameterFields
Select Case crParam.Name
Case "{?SortType}"
crParam.AddCurrentValue m_strSortType

End Select
Next crParam


For Each crFormula In crReport.FormulaFields
Select Case crFormula.Name
Case "{@.StartDate}"
crFormula.Text = "DATE( 2001, 01, 01)"
Case "{@.EndDate}"
crFormula.Text = "DATE( 2002, 03, 30)"
crFormula.Text = """All Offices"""
Case "{@.DetailOrSummaryFlag}"
crFormula.Text = """" & m_strSummaryDetailFlag & """"
Case "{@.Seperate}"
crFormula.Text = """FALSE"""
Case "{@.SetShowWarning}"
crFormula.Text = """FALSE"""
Case Else
'do nothing
End Select
Next crFormula|||Hi

I have a .NET application that needs to obtain the details of the parameters for a crystal report.

I have written some code, that opens a report into the crystal viewer and the gets the parameter info and displays it in a msgbox.

However, the viewer prompts for the parameters, before i get a chance to get the information and display it.:(

My question is, does anyone know of a way that i can get the parameter information from a report, without the user being prompted for the parameters ?

Thanks in anticipation

Dim APP As New CRAXDRT.Application
Dim REPORT As CRAXDRT.Report
REPORT = APP.OpenReport("C:\SHIPMENT_SCHEDULE\REPORTS\XL.rpt")

REPORT.EnableParameterPrompting = False
(this is the one you should include...disabling the parameter prompting)