Solved

Parameters in Crystal Reports 9 through VS.Net 2003

Posted on 2004-03-25
2
1,136 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

939 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

8 Experts available now in Live!

Get 1:1 Help Now