Solved

Parameters in Crystal Reports 9 through VS.Net 2003

Posted on 2004-03-25
2
1,152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

632 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