Solved

Parameters in Crystal Reports 9 through VS.Net 2003

Posted on 2004-03-25
2
1,133 Views
Last Modified: 2012-05-04
I am trying to set parameters correctly in an ASP.Net page for a crystal report but keep getting the message: Missing parameter field current value. Here is my current code:

CRV1.ReportSource = myReport
Dim ParameterFields As ParameterFields
ParameterFields = CRV1.ParameterFieldInfo
If Session.Item("Parm") <> "" Then
    Dim strParmName As String, strParmVal As String
    strParmName = Session.Item("ParmName")
    strParmVal = Session.Item("Parm")
    myReport.SetParameterValue(0, strParmVal)
Else
    Dim ParameterField As ParameterField
    ParameterField = ParameterFields.Item(0)
    If myReport.DataDefinition.ParameterFields(0).DefaultValues.Count > 0 Then
        ParameterField.CurrentValues = ParameterField.DefaultValues
    Else
        ParameterField.EnableNullValue = True
    End If
End If

Neither the Default nor the EnableNullValue seem to work.  What am I doing wrong - I can't seem to find any documentation on this for crystal 9.
0
Comment
Question by:pmcgivern
2 Comments
 
LVL 4

Accepted Solution

by:
stasau earned 250 total points
ID: 10677197
You still need to set the Parameter Value to NULL after you enable it to be null.  So the end of your if statement should look like:

    Else
        ParameterField.EnableNullValue = True
       myreport.SetParameterValue(0, vbNullString)
    End If

You could also create a ParameterValues object and set its value to null and add that to the ParameterField.CurrentValues collection but this is easier.
0
 
LVL 2

Author Comment

by:pmcgivern
ID: 10677392
Excellent - that works now for the nulls.  
Fixed the defaults problem too :
ParameterField.CurrentValues = ParameterField.DefaultValues

should be:

myReport.SetParameterValue(0, ParameterField.DefaultValues.Item(0))

Thanks.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now