Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Parameter prompt shows after report is loaded

Greetings,

I am testing CR XI R2 to be used with our current Visual FoxPro 8.0 environment application.

I am able to view the reports and pass parameters to the report with no problem, but the Parameter Prompt continues to show after the report has loaded up.

So the reports loads and is viewable, then immediately after it loads up, the Parameter Prompt shows up. I am not sure how this continues to happen, could someone please help me. All this was working perfectly fine under Crystal Reports 10 but in testing the runtime for CR 11 R2, the prompt continues to show after the report is loaded. I am attaching as much relevant code as possible, in hopes someone can help me pin point this weirdness.

Thanks in advance,

Albert

This is my _SetupReport() method

=======================================

    • Define variables

LOCAL oCRApplication AS CRAXDRT.Application

LOCAL oCRReport AS CRAXDRT.Report

WITH This

    • Instantiate the Crystal application object to the class's property

oCRApplication = CREATEOBJECT("CrystalRuntime.Application")

oCRReport = oCRApplication.OpenReport(._oParams.cReportPath)

oCRReport.DiscardSavedData()

    • Set up the report's database data

._SetupReportData(oCRReport)

    • Set up the report's parameters

._SetupParameters(oCRReport)

    • Assign the report to the control

.oleCrystalViewer.ReportSource = oCRReport

    • Turn on the flag to indicate that the class is set up

._lSetup = TRUE

ENDWITH

=======================================

This is my _SetupParameters() Method

=======================================

LPARAMETERS oCRReport AS CRAXDRT.Report

LOCAL aParameters[1] AS Variant

LOCAL cParamName AS String

LOCAL lFound AS Boolean

LOCAL nParam AS Integer

LOCAL nValueType AS Integer

LOCAL oErr AS Exception

LOCAL oParameter AS CRAXDRT.ParameterFieldDefinition

LOCAL oParamsCollection AS CRAXDRT.ParameterFieldDefinitions

LOCAL vDefaultValue AS Variant

LOCAL vParamValue AS Variant

WITH This

    • Copy the parameters array off the param transport object to

    • a local array

ACOPY(._oParams.aryParams, aParameters)

    • Get a reference to the parameter collection off the report

oParamsCollection = oCRReport.ParameterFields()

    • Loop once for each parameter

FOR nParam = 1 TO ALEN(aParameters, 1)

    • Turn on the found flag

lFound = .T.

    • Get the param name and value from the array

cParamName = aParameters(nParam, 1)

vParamValue = aParameters[nParam, 2]

TRY

    • Try to get the parameter

oParameter = oParamsCollection.GetItemByName(cParamName)

CATCH TO oErr

    • If here, the parameter was not found

lFound = .F.

ENDTRY

    • If the parameter was found...

IF lFound

    • Determine the param's data type and its default value

nValueType = oParameter.ValueType

vDefaultValue = oParameter.DefaultValue

    • If the parameter is a logical True...

IF VARTYPE(vParamValue) = 'L' AND vParamValue

    • Reset the parameter to its default value

oParameter.SetCurrentValue(vDefaultValue)

ELSE

    • Set the parameter to the array's value

oParameter.SetCurrentValue(vParamValue)

ENDIF

ENDIF

ENDFOR

ENDWITH

RETURN

=======================================

This is my ShowReport() method

=======================================

LPARAMETERS oParams AS Object

WITH This

    • If a parameter was passed in...

IF PCOUNT() > 0

    • If the parameter is an object...

IF TYPE('oParams') = 'O' AND NOT ISNULL(oParams)

    • Store the parameter to the class's property

._oParams = oParams

    • Call the routine to set up the report

._SetupReport()

WITH .oleCrystalViewer

    • Display the report

.ViewReport()

    • Pause to allow the report to finish getting data

DO WHILE .IsBusy

**DOEVENTS

oEnvision.oCommon.ProcessEvents()

ENDDO

.Visible = TRUE

ENDWITH

ELSE

ERROR 11 && Function argument value, type, or count is invalid

ENDIF

ELSE

ERROR 1229 && VFP - Reports

ENDIF

ENDWITH

=======================================

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question