Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Parameters in Crystal Reports 9 through VS.Net 2003

Posted on 2004-03-25
2
Medium Priority
?
1,156 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 1000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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 video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

916 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